jquery - How Can I run my script after validate,before POST in ASP.NET Web Forms? -


i want use webcontrols.validator(ex. requiredfieldvalidator) validation. can submit button twice , more.

<asp:textbox id="textbox1" runat="server"></asp:textbox> <asp:requiredfieldvalidator id="reqfld1" runat="server"controltovalidate="textbox1"></asp:requiredfieldvalidator>  <asp:button id="button1" runat="server" text="submit" />  $("form").on("submit", function(e){     if (waiting) return false;     waiting = true;     showmywattingdiv(); ) 

i tried code, if invalid i'm waiting too;

try code below. key use client-side api asp.net validators. here using property page_isvalid available in page whenever have asp.net validators on page.

<asp:textbox id="textbox1" runat="server"></asp:textbox> <asp:requiredfieldvalidator id="reqfld1" runat="server"controltovalidate="textbox1"></asp:requiredfieldvalidator>  <asp:button id="button1" runat="server" text="submit" />  $("form").on("submit", function(e){     if(!page_isvalid) {            return;     }     if (waiting) return false;     waiting = true;     showmywattingdiv(); ) 

you can check if particular validator valid using javascript below.

var validator = $("#<%=reqfld1.clientid%>")[0]; if(validator.isvalid) {   //do } 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -