I need help with my form. I want to disable the submit button when the user clicks it so they won't submit the form twice accidentally. However, I also do a bunch of error checking with javascript once the button is clicked. And if any required field is left blank the user gets a popup alert. The problem is that once they close the popup the form button is now disabled and they cannot submit the form without refreshing it. Is there a way to re-enable the form button if any error occurs?
Here's my form button:
<input type="image" src="pics/btn_submit.gif" width="80" height="19" name="submitit" onclick="this.disabled=true;dosubmit();">
And here's my script:
Any ideas?
Here's my form button:
<input type="image" src="pics/btn_submit.gif" width="80" height="19" name="submitit" onclick="this.disabled=true;dosubmit();">
And here's my script:
Code:
function dosubmit()
{
error = "";
{
if(document.frm_page.submitit.disabled == false)
{
document.frm_page.submitit.disabled=true;
}
if(error != "")
{
alert("----------- Error! ------------" + error);
}
else
{
document.frm_page.submit();
}
}
}
Any ideas?