asp.net - Required Field Validators firing in Chrome & Safari when button has CausesValidation="false" -
i'm having problems asp.net 4 application in chrome & safari (works in firefox , ie).
i have button declared using following code:
<asp:button id="btneoi1" runat="server" cssclass="buttoncss" text="lodge expression of interest" onclick="btneoi_click" causesvalidation="false" />
in code-behind file have following code:
protected void btneoi_click(object sender, eventargs e) { response.redirect("default.aspx", true); }
also on page logincontrol has 2 requiredfieldvalidators , regularexpressionvalidator:
<asp:requiredfieldvalidator id="usernamerequired" runat="server" controltovalidate="username" errormessage="please enter user name." setfocusonerror="true" display="none"> </asp:requiredfieldvalidator> <asp:regularexpressionvalidator runat="server" id="regularexpressionvalidator1" controltovalidate="username" errormessage="please enter user name without spaces." validationexpression="[\s]+" display="none" setfocusonerror="true" > </asp:regularexpressionvalidator> <asp:requiredfieldvalidator id="passwordrequired" runat="server" controltovalidate="password" errormessage="please enter password." setfocusonerror="true" display="none"> </asp:requiredfieldvalidator>
when click button in chrome , safari, usernamerequired , passwordrequired validators fire though button has causesvalidation="false". validation errors not occur in ie or firefox.
how can stop validators firing in chrome , firefox?
i have tested code in empty page , works correctly in browsers.
nervetheless try using validation groups.
just set same group usernamerequired, regularexpressionvalidator1, passwordrequired , login button.
Comments
Post a Comment