ui.datepicker.js form validation
I'm using ui.datepicker.js and I want to validate the date field to make sure the user select a date.
I have tried
function allow_submit()
{
var f = document.all.frm;
if (f.date.value == "") {
jAlert("Please select a date");
return f开发者_StackOverflow社区alse;
} //if
return true;
}
and also have try
if (f.date.value == "0000-00-00") {
without succes
Any clue?
Since you already have jQuery referenced on the page, why not leverage that power?
Assuming you've followed their convention and assigned a class of "datepicker" to your input element, try this:
function allow_submit() {
if($(".datepicker").val() == "") return false;
return true;
}
精彩评论