Enable/Disable Button through javascript [modified]
-
I have a asp.net page where my button is enabled or disabled depending on whether two textboxes are properly filled out. I enable/disable the button through the onchange events of the textboxes. Once button is enabled and I click it, the postback seems to have disappeared because it does nothing. I enable/disable the button like this:
function checkBuild() { document.getElementById('sMsg').innerHTML = ''; checkBAL(); checkINI(); if ((checkBAL()) && (checkINI())) { **document.form1.btn1.disabled = false;** checkWarning(); } else { **document.form1.btn1.disabled = true;** } }
I've read that in order for the button "btn1" to postback, I must have it enabled onLoad which I have done for testing. Therefore, if I click the button before my javascript fires, it works; only stops working once my checkBuild() function is called by the textboxes javascript onchange event. Can anyone help with this issue? Many thanks.
modified on Monday, September 22, 2008 10:31 PM
-
I have a asp.net page where my button is enabled or disabled depending on whether two textboxes are properly filled out. I enable/disable the button through the onchange events of the textboxes. Once button is enabled and I click it, the postback seems to have disappeared because it does nothing. I enable/disable the button like this:
function checkBuild() { document.getElementById('sMsg').innerHTML = ''; checkBAL(); checkINI(); if ((checkBAL()) && (checkINI())) { **document.form1.btn1.disabled = false;** checkWarning(); } else { **document.form1.btn1.disabled = true;** } }
I've read that in order for the button "btn1" to postback, I must have it enabled onLoad which I have done for testing. Therefore, if I click the button before my javascript fires, it works; only stops working once my checkBuild() function is called by the textboxes javascript onchange event. Can anyone help with this issue? Many thanks.
modified on Monday, September 22, 2008 10:31 PM