0

I'm using ASP.NET MVC 4, which as I understand it uses jQuery validate for client-side validation. Everything works pretty well and as expected, except for the HTML 5 date input

<input type="date" />

Whenever I begin typing a date into the input date field, the validator errors my field after the first number entered (assuming this happens onkeyup). I found the questions that say to disable onkeyup validation using:

$.validator.setDefaults({
    onkeyup: false
});

But that doesn't seem to do anything.

Is this a problem with the validate plugin, or am I doing something wrong?

EDIT: I explicitly stated that the answer in the question you cited did not solve my problem. Thanks though

Tevis
  • 729
  • 1
  • 12
  • 27
  • You should post your Javascript/HTML/MVC models so everyone can see exactly what's going on. [This might help](http://jqueryvalidation.org/date-method) in the meantime - the demo at the bottom illustrates that it *can* be done. On a side note, have you considered using a Datepicker? – alex Nov 17 '14 at 19:28
  • Are you sure the message is coming from jQuery Validate? If you've set `onkeyup: false` then the plugin is not doing it. However, with ASP.NET, you also have the `unobtrusive-validation` plugin. Also see: http://stackoverflow.com/q/12293125/594235 – Sparky Nov 17 '14 at 19:42
  • Yeah I was just looking at that. How do I make that not check validation onkeyup? – Tevis Nov 17 '14 at 19:44
  • Validation is as per jQuery Validate and Unobtrusive Validation only facilitates a more automatic way to use it within ASP.NET. In other words, you are already doing it correctly, but need to read the link I posted that explains what else you need to do. – Sparky Nov 17 '14 at 19:47
  • If the duplicate question doesn't solve your problem, you obviously need to give more details on how your problem is different. – lxg Nov 17 '14 at 20:42

0 Answers0