JQuery Datepicker Will not post with UK date string

前端 未结 3 380
臣服心动
臣服心动 2021-01-13 11:40

Apologies for if the question is obvious but I can\'t figure out why it is suddenly not working. I have a jquery datepicker that has been working fine as long as I can remem

3条回答
  •  臣服心动
    2021-01-13 12:07

    a google search gave a lot of results relating to localizing/globalizing asp.net mvc 3 validation.

    this article in particular might be on to something:

    http://www.hanselman.com/blog/GlobalizationInternationalizationAndLocalizationInASPNETMVC3JavaScriptAndJQueryPart1.aspx

    scroll down to: "Globalized jQuery Unobtrusive Validation"

    the answer to this question might help as well: Localizing jquery validation with asp.net mvc 3

    jQuery allows you to override the different validation functions like so:

     $.validator.methods.number = function (value, element) {
         return !isNaN($.parseFloat(value));
     }
    

    you could do something like this for the date validator, and run it against a regEx for a valid UK date.

提交回复
热议问题