Because the jquery validation Form Verification plug-in is applied in the project, submit the form after the validation is completed, and then disable the button.
There is a disablebtnpostback project in codeproject, but it works with jquery validation, Code Post the code first and remind everyone not to use the code in this case. The Code is as follows:
JS:
Code
Copy code The Code is as follows: function disablebtn (btnid, newtext ){
Page_isvalid = NULL;
If (typeof (page_clientvalidate) = 'function '){
Page_clientvalidate ();
}
VaR BTN = Document. getelementbyid (btnid );
VaR isvalidationok = page_isvalid;
If (isvalidationok! = NULL ){
If (isvalidationok ){
BTN. Disabled = true;
BTN. value = newtext;
BTN. style. Background = "url(12501270608.gif )";
}
Else {
BTN. Disabled = false;
}
}
Else {
SetTimeout ("setimage ('" + btnid + "')", 10 );
BTN. Disabled = true;
BTN. value = newtext;
}
}
Function setimage (btnid ){
VaR BTN = Document. getelementbyid (btnid );
BTN. style. Background = 'url(12501270608.gif )';
}
Front-end Page code:
CodeCopy codeThe Code is as follows: <asp: button id = "btnone" tabindex = "0" runat = "server" text = "Submit"
Onclick = "btnone_click"
Onclientclick = "disablebtn (this. ID, 'submitting ...')"
Usesubmitbehavior = "false"/>
Okay, the following code solves the problem of submitting a form after the Form Verification of the validation plug-in is completed by the submit button. submit the form:
JS:
CodeCopy codeThe Code is as follows: $ (document). Ready (function (){
$ ("# Myform"). Validate ({
Submithandler: function (form ){
$ (Form). Find (": Submit"). ATTR ("disabled", true). ATTR ("value ",
"Submitting ...");
Form. Submit ();
}
})
});