Combining the jquery Calendar picker with the jquery validation and getting them to play nice?
- by MBonig
I'm just starting to get into jquery/javascript programming so this may be a beginner question but I sure can't seem to find anything about it.
I have a text field on a form. I've used the JQuery UI Calendar picker to make data entry better. I've also added jquery validation to ensure that if the user enters the date by hand that it's still valid.
Here is the html:
<input class="datepicker" id="Log_ServiceStartTime_date" name="Log_ServiceStartTime_date" type="text" value="3/16/2010"></input>
and javascript:
$('form').validate();
$('#Log_ServiceStartTime_date').rules('add','required');
$('#Log_ServiceStartTime_date').rules('add','date');
the problem I'm having is this:
If a user puts in a bad date, or no date at all, the validation correctly kicks in and the error description displays. However, if the user clicks on the textbox to bring up the calendar picker and selects a date, the date fills into the field but the validation does not go away. If the user clicks into the textbox and then back out, the validation correctly goes away.
How can I get the calendar picker to kick off the validation routine once a date is selected?
thanks