Date of birth validation
Hi,
Is there a way to add a validation on a datapicker in a way that if the user adds a date of birth which provides evidence that he/she is not over 18 years old to stop them submiting the form?
Hi,
Is there a way to add a validation on a datapicker in a way that if the user adds a date of birth which provides evidence that he/she is not over 18 years old to stop them submiting the form?
Try changing:
$(function(){
$('#dob').datepicker({
changeMonth: true,
changeYear: true,
onClose: closeDatePicker_dob
});
});
to:
var maxBirthdayDate = new Date();
maxBirthdayDate.setFullYear( maxBirthdayDate.getFullYear() - 18,11,31);
$(function(){
$('#dob').datepicker({
changeMonth: true,
changeYear: true,
onClose: closeDatePicker_dob,
maxDate: maxBirthdayDate,
yearRange: '1920:'+maxBirthdayDate.getFullYear()
});
});
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.