2017-01-15 5 views
0

동일한 이름 값을 갖는 하나의 양식에서 여러 라디오 버튼 그룹을 가질 수 있습니까?동일한 이름의 여러 라디오 버튼 그룹이 있습니까?

내가 여러 구성 퀴즈에서 일하고 있어요 (질문) 라디오 버튼 그룹은 같은 :

<div class="question"> 
        <p><b>Question 19</b></p> 

        <div class="choices"> 

          <input type="radio" name="choice-for-question-98" id="choice-98-1" value="389"> 
          <label for="choice-98-1">e duhur </label><br> 

          <input type="radio" name="choice-for-question-98" id="choice-98-2" value="388"> 
          <label for="choice-98-2">qëllim</label><br> 

          <input type="radio" name="choice-for-question-98" id="choice-98-3" value="387"> 
          <label for="choice-98-3">drejt</label><br> 

          <input type="radio" name="choice-for-question-98" id="choice-98-4" value="386"> 
          <label for="choice-98-4">e drejtë</label><br> 

        </div> 
       </div> 

내가 원하는 "대답"POST 속성의 목록을 얻을 것입니다하지만 동일하게 설정하는 경우 다른 질문에 대한 이름, 사용자는 모든 질문에서 단 하나의 라디오 버튼을 선택할 수 있습니다.

답변

1

이 이름은 라디오 버튼이 속한 그룹을 정의하는 데 사용되는 메커니즘입니다.

비슷하지만 다른 이름을 사용할 수 있으며 루프를 사용하여 서버에서 이름을 찾을 수 있습니다.

name="choice-for-question-98-group-1" 

my $choice; 
my $group = 1; 

while ($choice = $q->param("choice-for-question-98-group-" . $choice)) { 
    do_something_with($choice); 
    $group++; 

}