问题
i am adding one more radio button in a div
of jsp page. But the newly added radio button is selecting always and when i click on second radio button, it is also going to select. is there any script to write to this.
<div style="padding-left:15px">
<div>
Entry Mode Code was:
</div>
<div style="padding-left:30px">
<div>
<html:radio name="caseForm" property="questionnaire.RP0062.posEntryModeCd" value="A" styleId="posEntryModeCda"> 05 - Chip Card read (data is reliable)</html:radio>
</div>
<div>
<html:radio name="caseForm" property="questionnaire.RP2462.posEntryModeCd" value="B"> 90 - Magnetic Stripe Terminal and the full unaltered contents of the selected track is included</html:radio>
</div>
<div>
<html:radio name="caseForm" property="questionnaire.RP2462.posEntryModeCd" value="C" > Not Applicable</html:radio>
</div>
</div>
</div>
the image attached:

回答1:
You should have the same value for the property
attribute of all the three radio buttons, i.e. property="questionnaire.RP2462.posEntryModeCd"
for all the three:
<div>
<html:radio name="caseForm" property="questionnaire.RP2462.posEntryModeCd" value="A" styleId="posEntryModeCda"> 05 - Chip Card read (data is reliable)</html:radio>
</div>
<div>
<html:radio name="caseForm" property="questionnaire.RP2462.posEntryModeCd" value="B"> 90 - Magnetic Stripe Terminal and the full unaltered contents of the selected track is included</html:radio>
</div>
<div>
<html:radio name="caseForm" property="questionnaire.RP2462.posEntryModeCd" value="C" > Not Applicable</html:radio>
</div>
Hope this helps
回答2:
i have entered wrong name instead of given below..
<html:radio name="caseForm" property="questionnaire.RP0062.posEntryModeCd" value="A" styleId="posEntryModeCda"> 05 - Chip Card read (data is reliable)</html:radio> </div>
in the above i should give questionnaire.RP2462.posEntryModeCd
as below radio buttons also having. Then only it is working.
Thanks..
来源:https://stackoverflow.com/questions/11689530/two-radio-buttons-are-selecting-at-once