I'm having problems with jQuery validate when using a jQuery mobile datebox.
I have my validation set to:
onkeyup: false
Which I believe triggers the validation on the focus/blur (tab) event instead.
The problem is that when I set the date using the datebox picker it doesn't seem to fire this event, so if I have a datebox with the date as "required" and it's filled out, the error message is still shown...
Edit:
Here is my fiddle:
HTML
<form id="my_form" method="post">
<input name="name" id="full-name" data-theme="a" placeholder="Name" class="required">
<input name="athlete_datebox" id="athlete_datebox" data-theme="a" placeholder="Date of Birth" class="required">
<input type="submit" value="submit">
</form>
JS
$(document).ready(function () {
$('#my_form').validate({
onkeyup: true
});
$('#athlete_datebox').mobiscroll().date({
theme: 'jqm',
display: 'modal',
mode: 'clickpick',
dateOrder: 'mmD ddyy',
dateFormat: 'yy-M-dd',
endYear: 2034
});
$('#my_form').on('submit', function (event) {
event.stopPropagation();
event.preventDefault();
if ($('#my_form').valid()) {
alert('is valid');
}
});
})
If you hit "submit" before filling out anything, you see that both fields are required. However after filling out the date with the mobiscroll date picker, the field is still listed as required even though it is not empty.