0

我正在使用 formvalidation.io 插件进行验证。默认情况下,它会验证单选按钮的名称。但我不能那样做。我需要以某种方式/逻辑来区分每个单选按钮组的每个名称。

有人能帮我吗?

例子:

<div>
    <div id="perguntas">
        <label>1 - Pergunta 1</label>
        <input type="hidden" name="pergunta[]" value="$pergunta->id" />
        <div id="respostas">
            <input type="radio" name="resposta[$pergunta->id]" value="1" /> Male
            <input type="radio" name="resposta[$pergunta->id]" value="2" /> Female
            <input type="radio" name="resposta[$pergunta->id]" value="3" /> Other
        </div>
        <div>
            <textarea name="mensagem[$pergunta->id]" rows="3" />
        </div>
    </div>
    <div id="perguntas">
        <label>2 - Pergunta 2</label>
        <input type="hidden" name="pergunta[]" value="$pergunta->id" />
        <div id="respostas">
            <input type="radio" name="resposta[$pergunta->id]" value="1" /> Male
            <input type="radio" name="resposta[$pergunta->id]" value="2" /> Female
            <input type="radio" name="resposta[$pergunta->id]" value="3" /> Other
        </div>
        <div>
            <textarea name="mensagem[$pergunta->id]" rows="3" />
        </div>
    </div>

    <div id="perguntas">
        <label>3 - Pergunta ...</label>
        <input type="hidden" name="pergunta[]" value="$pergunta->id" />
        <div id="respostas">
            <input type="radio" name="resposta[$pergunta->id]" value="1" /> Male
            <input type="radio" name="resposta[$pergunta->id]" value="2" /> Female
            <input type="radio" name="resposta[$pergunta->id]" value="3" /> Other
        </div>
        <div>
            <textarea name="mensagem[$pergunta->id]" rows="3" />
        </div>
    </div>

    <div id="perguntas">
        <label>16 - Pergunta 16</label>
        <input type="hidden" name="pergunta[]" value="$pergunta->id" />
        <div id="respostas">
            <input type="radio" name="resposta[$pergunta->id]" value="1" /> Male
            <input type="radio" name="resposta[$pergunta->id]" value="2" /> Female
            <input type="radio" name="resposta[$pergunta->id]" value="3" /> Other
        </div>
        <div>
            <textarea name="mensagem[$pergunta->id]" rows="3" />
        </div>
    </div>  
</div>
4

0 回答 0