Forum Moderators: open
I added in the following line to function 'setFormSubmitMarker' that gets called when the user selects an option:
frm.selOption.disabled=true;
This greyed out the select box ok but stopped the value of the select from being posted (I've removed the PHP code that I used to read the posted variable). It seems as though disabling the select box also prevents the form from posting the value of the select box? I tried swapping the order of the two lines in the function function 'setFormSubmitMarker' but that didn't work. Please can anyone suggest a solution?
Here's the code:
<html>
<body>
<script>
function setFormSubmitMarker(frm,valu) {
frm.selOption.disabled=true;
frm.whichSubmit.value=valu;
}
</script>
<form method="POST">
<input type="hidden" name="whichSubmit" value="">
<select name="selOption" onchange="setFormSubmitMarker(this.form,'selectmenu');this.form.submit();">
<option value="NULL">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
<input type="submit" onclick="setFormSubmitMarker(this.form,'submitbutton')">
</form>
</body>
</html>
Having said that, browsers are multithreaded (i.e. tasks may be carried out concurrently rather than sequentially) so this may not work. In this case, you must use a delay, of, say 1000 milliseconds.
setTimeout("frm.selOption.disabled=true",1000);
Kaled.