2011 Q1 has broken one of my inputs

3 posts, 0 answers
  1. Dan Ware
    Dan Ware avatar
    17 posts
    Member since:
    Mar 2010

    Posted 21 Apr 2011 Link to this post

    I have a page which uses a RadDateInput which plays quite nicely.  In another place I have an <asp:textbox /> control in which I dynamically set to a date input using a RadInputManager, if the answer required is a date.

    These are both on the same page and the client "onerror" properties point to the following javascript function;

    function OnError(sender,args){args.set_cancel(true)}

    As I mentioned, the RadDateInput plays nicely but the RadInputManager one crashes if you don't enter a valid date (then tab/click out of the box or submit) with a javascript error; for example, "G.getFullYear is not a function".  This occurs in all browsers.

    Working:
    <telerik:RadDateInput ID="txtDOB" runat="server" SelectionOnFocus="SelectAll" DateFormat="d" MinDate="01/01/1930" MaxDate="01/01/2000" Culture="en-GB" EmptyMessage="DD/MM/YYYY"><ClientEvents OnError="OnError" /></telerik:RadDateInput>

    Broken:
    <telerik:DateInputSetting BehaviorID="setDate" DateFormat="d" Culture="en-GB" EmptyMessage="DD/MM/YYYY" ClientEvents-OnError="OnError" SelectionOnFocus="SelectAll" />

    It appears that the javascript OnError() is not working for this control - but what is worse is that if I do not have the ClientEvents-OnError attribute set then I cannot submit valid dates!  The control shows it's error state when a valid date is entered and prevents form submission!

    This is a very busy high-profile website - I might need to raise a ticket but I'm posting here first in case anyone else is familiar with this behaviour?
  2. Dan Ware
    Dan Ware avatar
    17 posts
    Member since:
    Mar 2010

    Posted 21 Apr 2011 Link to this post

    To clarify, when I do not have the ClientEvents-OnError attribute set, the date input auto-corrects dates but when it loses focus it has the yellow icon and prevents submission.  As an example, I have "01/01/1970" as the value.

    If you were to hit enter when it does have focus, the form submits.  If you click the submit button then the validation prevents submission.

    This is not acceptable as many users are using mobile devices and cannot submit the form.  Having the OnError function allows it to work, but only if they enter a valid date (dd/mm/yyyy)!
  3. Dan Ware
    Dan Ware avatar
    17 posts
    Member since:
    Mar 2010

    Posted 21 Apr 2011 Link to this post

    OK I've solved this by removing my client-side OnError handler for the "input manager date input" and setting a minimum date.

    The default minimum date is 01/01/1980 if you do not set it, which was not obvious.

    My fixed version;

    <telerik:DateInputSetting BehaviorID="setDate" DateFormat="d" Culture="en-GB" SelectionOnFocus="SelectAll" MinDate="01/01/1900" />

Back to Top