Conditional radio button
Conditional radio button
Hi guys,
Please help. I am totally newbie.
I have one form.
it contains radio buttons
<tr>
<td><input name="ProjExistOPAContract" type="radio" class="radio" id="ProjExistOPAContractYes" value="1" <?php //if (!(strcmp($row_rsEmail['ProjExistOPAContract'],"1"))) {echo "checked=\"checked\"";} ?> /></td>
<td><label for="ProjExistOPAContractYes" class="label100">Yes</label></td>
</tr>
<tr>
<td><input name="ProjExistOPAContract" type="radio" class="radio" id="ProjExistOPAContractNo" value="0" <?php //if (!(strcmp($row_rsEmail['ProjExistOPAContract'],"0"))) {echo "checked=\"checked\"";} ?> /></td>
<td><label for="ProjExistOPAContractNo" class="label100" >No</label></td>
</tr>
I have other fields on the form. so I have jquery already written for onSubmit fields.
####################################
$("#applicationForm").validate({
errorContainer: $("#summary"),
rules: {
ApplicantLegalName: { required: true, minlength: 2 },
ApplicantPrimaryContactFName: { required: true, minlength: 2 },
|
|
| etc
#####################################
I tried this
ProjExistOPAContract: { required: function(element) { return $("input:radio[name='ProjExistOPAContract']:checked").val() == '0'; } },
ProjExistOPAContract is name of radio group. I want if user selects No then it submit otherwise it shows error.
Please help.
Thanks in advance