asp.net - How Can disable and enable RequiredFieldValidator for controls with jquery -
in page have 2 radio-button based which-one selected show controls in page using classes called 'person' , 'organization'. moreover, want check user enter correct data in input-text controls. how can validta data in clientside? example:
<input runat="server" id="txtnationalid" maxlength="10" name="txtnationalid" class='person ltr glow-onfocus customercode required number' dir="ltr" /> <asp:requiredfieldvalidator display="dynamic" runat="server" id="txtcodecv1" errormessage="it can not null" controltovalidate="txtnationalid" ></asp:requiredfieldvalidator> <asp:regularexpressionvalidator validationexpression="[0-9]{10}" display="dynamic" runat="server" id="txtcodev2" errormessage="it's not in correct format" controltovalidate="txtnationalid" ></asp:regularexpressionvalidator> <input runat="server" id="txteconomiccode" maxlength="15" name="txteconomiccode" class='organization ltr glow-onfocus customercode required number' dir="ltr" /> <asp:requiredfieldvalidator display="dynamic" runat="server" id="txtcodecv3" errormessage="economiccode required" controltovalidate="txteconomiccode"></asp:requiredfieldvalidator>
you can use jquery
<script> $(document).ready(function(){ $("#commentform").validate(); }); </script> </head> <body> <form class="cmxform" id="commentform" method="get" action=""> <input type="text" name="firstname" class="required"/> <input type="submit" value="submit"/> </form> </body> </html>
see here mode details
Comments
Post a Comment