I have asp.net form with text boxes and drop downs. I do client side validation for these controls on a button click.
For example, to validate the below firstname textbox, I am using jquery to check for no input and valid characters. If textbox is empty first <span>
will be displayed. If invalid characters are typed second <span>
will be displayed. Now on the button click I want to get the error message shown (anyone one ).
<asp:TextBox ID="firstNameTxt" runat="server"></asp:TextBox>
<br />
<span class="validation validation-checkEmpty">Please enter your first name.</span>
<span class="validation validation-checkValidChars">We can only accept letters, apostrophes, and hyphens for your first name.</span>
I have to do this for all textboxes, drop downs, checkboxes in the form.
So my question is how to get the error message shown in <span>
when the validation fails. I have to do this for all controls in the form.
Can anyone guide me in the right way.
Thanks,
Arul