This is a migrated thread and some comments may be shown as answers.

Calling Date Input Validation Error

2 Answers 82 Views
Input
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Iron
Daniel asked on 15 Jul 2010, 03:15 AM
Hi. I notice that if you input an incorrect date that the raddatepicker textbox highlights red with a yellow exclamation mark inside it. This is cool, especially when restricted for space. I have a requiredfieldvalidator that I would like to apply the same error to. Is there any way to call this from say javascript? Thanks.

Daniel

2 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 19 Jul 2010, 02:53 PM
Hi Daniel,

The highlighted red with a yellow exclamation mark inside it is actually a style called InvalidStyle in the RadDatePicker. You can apply it manually to your validator and calls it when the validation triggers. Please refer to the following help topic for more information on RadCalendar styles.

Kind regards,
Maria Ilieva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Daniel
Top achievements
Rank 1
Iron
answered on 22 Jul 2010, 02:30 AM
Hi Maria. Thanks for pointing me in right direction. Just in case anyone else needs to implement this, here's my code.

ASP.NET
<asp:CustomValidator ID="csStartDate" runat="server" ClientValidationFunction="clientValidate" ControlToValidate="rdpStart" ValidateEmptyText="true" ErrorMessage="" Display="None" ValidationGroup="vgLeave"></asp:CustomValidator>

JS
function clientValidate(sender, args) {
        if (args.Value.length <= 0) {
            args.IsValid = false;
            var datepicker = $find("<%=rdpStart.ClientID%>");
            datepicker.get_dateInput()._textBoxElement.className = "riTextBox riError";
        }
    }
Tags
Input
Asked by
Daniel
Top achievements
Rank 1
Iron
Answers by
Maria Ilieva
Telerik team
Daniel
Top achievements
Rank 1
Iron
Share this question
or