How disable RequiredFieldValidator in script

Posted by jlp on Stack Overflow See other posts from Stack Overflow or by jlp
Published on 2010-04-22T08:47:05Z Indexed on 2010/04/22 8:53 UTC
Read the original article Hit count: 349

Filed under:
|

I have TextBox with RequiredFieldValidator on my page. I also have link that calls some simple javascript.

<asp:TextBox ID="TextBox1" runat="server" />
<asp:RequiredFieldValidator
ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox1"
Display="Dynamic" /> 
<asp:LinkButton   ID="Link1" runat="server" OnClientClick="DoSomething(); return false;" CausesValidation="false"Text="Do" />

function DoSomething() {
textbox1.val("blah"); }

How to prevent RequiredFieldValidator to fire when TextBox1 is empty and it looses focus? I want RequiredFieldValidator only to fire on postback.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about validators