Form Button won't re-enable after having been disabled via onClick
Posted on 2007-07-25
I'm using a regular button (instead of a submit button) to submit my form.
In addition to the required field checking script being triggered onClick, I am also disabling the button (to prevent multiple clicks). My button code is as follows:
<input name="process" id="process" type="button" value="Process Order" onClick="check(myform,myform.elements.length);document.getElementById('process').disabled = true;" style="cursor:pointer;" />
My form has the name "myform" as well as the id value of "myform"
The button DOES become disabled when clicked - that part is no problem.
document.getElementById('process').disabled = false;
Well it's NOT working.
The button in the form remains disabled after the user clicks on the "OK" button in the alert dialog.
The behavior is the same in both Firefox 2 and IE7.
I've tried to add onSubmit="document.getElementById('process').disabled = false;" to the form tag, .. thinking that this would be the most logical approach. But that doesn't seem to work either.
How can I achieve this effect? Ideally, I'd like a solution that doens't require me to modify my JS file for the required field checking. Any tips or advice would be appreciated.