开发者

jquery date validation problem

I have text box with the class=required date, it validates it, but when user manually enters 35-10-2010 whe开发者_如何学运维re 35 is the date it submits the form and sets date to 31.

How can i generate an error and prevent form submission ???


From what I can get by seeing the code you have posted (which is not enough, mind you!!), you are using HTML5, since the date-input control has been newly added in HTML5.

If this is the case, then for enforcing the validation, you should be procedding like this....

Your Code

<input type="text" name="gsdateshow" id="gsdateshow" class="required date" value="<?php echo $value?>" />

The code should be like

<input type="text" name="gsdateshow" id="gsdateshow" required="required" value="<?php echo $value?>" />

See the required attribute there - that is new in HTML5 as well.

So, AFAI can see you should have no need to use jquery. Why did you include it in your code?

If this is not what you are looking for, then you should follow the advice of people who have commented on your question and show us more code, throwing some light on the points below...

  • Why are you using jQuery?
  • Show us the code where you are performing validation/submitting the form
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜