I have been having an issue getting a form's submit button to disable and still process the form. What I did works in Firefox, but not in Internet Exlporer.
Basically, the site is for a user to enter a password and they are presented with a list of dynamically generated files they can download. When a user clicks a button, we want the button (I'm using image as the type) to swap to a "greyed out" style and then disable the button so that they cannot keep downloading the file over and over.
Here is the javascript I am using to disable/swap the button:
<script language="JavaScript" type="text/javascript">
function formDisable(id)
{
document.getElementById(id).disabled=true;
document.getElementById(id).src="../images/getitnowbuttonoff.gif";
}
</script>
And here is the form:
echo '<FORM ACTION="download.php" METHOD="post">';
echo '<INPUT TYPE="hidden" VALUE="' . $code . '" NAME="code">';
echo '<INPUT TYPE="hidden" VALUE="' . $table . '" NAME="table">';
echo '<INPUT TYPE="hidden" VALUE="' . $file . '" NAME="filename">';
echo '<INPUT TYPE="hidden" VALUE="' . $available_count . '" NAME="available_count">';
echo '<INPUT TYPE="hidden" VALUE="' . $counter . '" NAME="file_num">'; // File number
echo '<INPUT TYPE="hidden" VALUE="' . $number . '" NAME="structure">'; // download directory
echo '<INPUT id="' . $id . '" TYPE="image" src="../images/getitnowbutton.gif" width="135" height="29" onmouseup="formDisable(\'' . $id . '\')">';
echo '</FORM>';
We had to pass a variable to the JavaScript because there can be more than one form depending on how many files our clients submit. I had it working in both browsers before doing this, however if I clicked "button #5", only "button #1" would disable/swap.
Hopefully I made sense and someone could help me out with this. I would be extremely grateful as this has been driving me nuts for two days
