jQuery Validation plugin is used to validate all form data: http://docs.jquery.com/Plugins/Validation
Have 3 select fields for birth date: day, month, year.
First: How i can make sure that user selects all 3 fields and 'invalid' icon is displayed only when one of all three fields is not selected. For example, now i have those 3 select fields, but when i select first and it's ok, then plugin displays 'ok' icon even if other two select fields (month, year) are not selected.
Second: How i can validate those 3 select fields and make sure that the person, which birth date is selected in those 3 select fields, is older than 18 years?
<select name="DOBd" id="DOBd">
<option value="">DD</option>
// day options
</select>
<select name="DOBm" id="DOBm">
<option value="">MM</option>
// month options
</select>
<select name="DOBy" id="DOBy">
<option value="">YYYY</option>
// year options
</select>
Also i set up that 'error' icon is displayed not after each one of them, but after all of them:
groups:{
date_of_birth:"DOBd DOBm DOBy"
},
errorPlacement:function(error,element){
if (element.attr("name") == "DOBd" || element.attr("name") == "DOBm" || element.attr("name") == "DOBy")
error.appendTo(element.parent("td").next("td"));
else
error.appendTo(element.parent("td").next("td"));
},