This is a migrated thread and some comments may be shown as answers.
2011 Q1 has broken one of my inputs
2 Answers 21 Views
This is a migrated thread and some comments may be shown as answers.
Dan Ware
Top achievements
Rank 1
Dan Ware asked on 21 Apr 2011, 12:59 PM
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 Answers, 1 is accepted

Sort by
0
Dan Ware
Top achievements
Rank 1
answered on 21 Apr 2011, 02:25 PM
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)!
0
Dan Ware
Top achievements
Rank 1
answered on 21 Apr 2011, 02:53 PM
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" />

Tags
Input
Asked by
Dan Ware
Top achievements
Rank 1
Answers by
Dan Ware
Top achievements
Rank 1
Share this question
or