Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
Invalid Date
posted

Is there a way to cancel the formatting of an invalid date with the webdatechooser? When a user enters an invalid date, I would like to display a message rather than reformatting it for them. I have the InvalidDateEntered event handled on the client side, but there does not seem to be a way to cancel the formatting without modifying the script files the control uses.

 

Thank you,

Chad

 

  • 24497
    posted

    Hi Chad,

    It is correct default behavior of WebDateChooser to restore last good date in case of invalid date. To modify that you need to use internal objects. If you may look at implementation of ig_webdropdown.js then you may find members "date" and "editor.good". If you set them to nulls, then last "good" date will be disabled. Unfortunately in case of misbehavior there is no support for usage of internal variables.

    function WebDC_InvalidDateEntered(oDateChooser,oInvalidEventArgs,oEvent)
    {
      oDateChooser.date=
    null;
      oDateChooser.editor.good=
    null;
      //alert('invalid date');
      //oDateChooser.date = new Date(....);
    }