Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6812711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:28:57+00:00 2026-05-26T20:28:57+00:00

Apologies for if the question is obvious but I can’t figure out why it

  • 0

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 remember, but all of a sudden, when I try to submit the form that the datepicker is on the datepicker reappears as though the date I am submitting is invalid. I have already set my date to uk style using the following line of code:

    <script type="text/javascript">
    $(document).ready(function () {
        $('.date').datepicker({ dateFormat: "dd/mm/yy", minDate: 0 });

    }); 
    </script>

And I setup the datepicker in my view like this:

@Html.TextBox("DateDue", "", new { @class = "date" })

I think that something is requiring the datestring selected to be in US format (as it will submit a valid us date (mm/dd/yyyy) but not the UK format, even though it has been set in the javascript.

Am I missing something obvious? Could anyone tell me what I’m doing wrong here?

Am not sure if it is necessary but the form that the datepicker is on is created like this:

@using (
    Html.BeginForm(
        Html.BeginForm(
            "Create",
            "Task",
            FormMethod.Post,
            new { id = "taskCreateForm" }
        )
    )
)

PS. The datestring actually works and posts without a problem in Firefox but not in Chrome

Any help appreciated

EDIT:

The problem goes away when I disable the unobtrusive js validation:

<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"
        type="text/javascript"></script>

I had a feeling it was something to do with this and tried remoing the [Required] and [DataType(DataType.Date)] from the model annotation but this didn’t do the trick.

Not sure how to leave the unobtrusive js in as well as have the uk date string working ok, but am more and more turning to write my own javascript validation for forms than to even bother with the built in stuff, which never seems to work for anything more complicated than a ‘required’ validation check..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:28:58+00:00Added an answer on May 26, 2026 at 8:28 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Straightforward question - apologies if it is a duplicate, but I can't find the
I am not sure if I can post this sort of question (apologies in
Apologies if my question is a little badly worded but I am not quite
Apologies if the answer to this question is completely obvious but it has me
Apologies if this has been asked before but it seems an obvious question for
This may be a very obvious question - apologies if it is. I have
I can only imagine I'm not searching correctly; this seems like an obvious question
OK, possible stupid question - apologies - but can you install the SDK and
Apologies for asking what's probably a very obvious question, I've been banging my head
I apologize before hand if this is an obvious question: can Apache 2.0 +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.