lundi 4 juillet 2016

If specific checkbox is selected, to make text box compulsory (checkbox group)

I have a group of check boxes with the same name. The user needs to select at least one checkbox and if "Others" is selected, the "Promotion_Others" text box is compulsory.

I am not sure how to do this with the check boxes all having the same name.

<input type="checkbox" name="Prefer_Promotion[]" value="food_and_beverages_discounts" >Food & beverages discounts</label>
<input type="checkbox" name="Prefer_Promotion[]" value="complimentary_hotel_facilities">Complimentary hotel facilities</label>
<input type="checkbox" name="Prefer_Promotion[]" value="complimentary_gym_access">Complimentary gym access</label>
<input  type="checkbox" name="Prefer_Promotion[]" value="others">Others</label>
<input type="text" class="form-control" name="Promotion_Others" value="" maxlength="50"/>




Aucun commentaire:

Enregistrer un commentaire