asp.net - test if page is valid before running javascript -
i have javascript "freezes" screen when submit button pressed. stop double clickers.
i have discovered there issue if validator control returns false, in that, screen has "frozen", user can't fix problem input data.
i need able tell if page valid or not, if not, can un-freeze screen.
how can this??
javascript code freezes screen... (originally 4guysfromrolla)
function freezescreen(msg) { var outerpane = document.getelementbyid('freezepane'); var innerpane = document.getelementbyid('innerfreezepane'); if (outerpane) outerpane.classname = 'freezepaneon'; }
code runs javascript...
<asp:button id="btnsubmit" runat="server" text="<%$ resources:localizedtext, button_submitorder %>" onclick="btnsubmit_click" validationgroup="validateheader" onclientclick="freezescreen();" />
it this.
function validatepage() { freezescreen(); if (typeof (page_clientvalidate) == 'function') { page_clientvalidate(); } if (page_isvalid) { unfreezescreen(); return true; } else { unfreezescreen(); return false; } }
and on button
<asp:button id="btnsubmit" runat="server" text="<%$ resources:localizedtext, button_submitorder %>" onclick="btnsubmit_click" validationgroup="validateheader" onclientclick="return validatepage();" />
Comments
Post a Comment