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

Alerting the error messages.

1 Answer 16 Views
Input
This is a migrated thread and some comments may be shown as answers.
Ivy
Top achievements
Rank 1
Ivy asked on 24 Jul 2013, 02:25 AM
Hi 

There are few input fields and required field validators and I tried to display the error message inside the control which is not completely possible due to browser related issues. So I thought of alerting the error messages on validation failed. But how can I get the error messages in javascript so that I can display them in an alert box? Is this a possible requirement?

Thanks
Ivy

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 08 Nov 2013, 11:49 AM
Hi Ivy,

Please have a look into the code snippet to alert an error message of RequiredFieldValidator on validation failed.

ASPX:
<telerik:RadTextBox ID="TxtEmail" runat="server">
</telerik:RadTextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtEmail"
    ValidationGroup="ValidationGroup1" ErrorMessage="TxtEmail Required">
</asp:RequiredFieldValidator>
<br />
<telerik:RadTextBox ID="TxtPassword" runat="server">
</telerik:RadTextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TxtPassword"
    ValidationGroup="ValidationGroup1" ErrorMessage="TxtPassword Required">
</asp:RequiredFieldValidator>
<br />
<telerik:RadButton ID="RadButton1" runat="server" Text="Submit" ValidationGroup="ValidationGroup1"
    AutoPostBack="false">
</telerik:RadButton>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="true"
    ValidationGroup="ValidationGroup1" />

CSS:
<style type="text/css">
    #RequiredFieldValidator1
    {
        display : none !important;
    }
  #RequiredFieldValidator2
    {
        display : none !important;
    }
    #ValidationSummary1
    {
        display : none !important;
    }
</style>

Thanks,
Shinu.

Tags
Input
Asked by
Ivy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or