开发者

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜