Forum Moderators: open
Both work fine.
However, when I select one, and then quickly click on the other before the first one changes the screen, I lose control and get a blank screen. After that, I have to refresh to use it again.
I am sure this is due to triggering both forms at once, but I need to either prevent it or make a check that captures it and restores the screen.
Can anyone help?
<script language="JavaScript">
<!--
function disable(what){
document.getElementById(what).disabled = true;
}
//-->
</script>
<select name="sel" onchange="disable('sel2')">
<option value="1">one</option>
<option value="2">two</option>
</select>
<br />
<select name="sel2" onchange="disable('sel')">
<option value="1">one</option>
<option value="2">two</option>
</select>
I was half way through doing this example when BlobFisk answered with the correct solution. So here is the example anyway...
Welcome to WebmasterWorld.
-George
<form method=post id="cmform" name="cmform" action="something">
<select name='comm' onchange="disable('dpform'); cmform.submit()">
<option selected>None</option>
<option value=1>One</option>
</select>
<br>
</form>
</td>
<td>
<br>
<form method=post id="dpform" name="dpform" action="something">
<select name='depot' onchange="disable('cmform'); dpform.submit()">
<option selected>None</option>
<option value=1>One</option>
</select>
<br>
</form>
At present you are disabling the form rather than the combo/select box. What happens when you try it like this:
select name='comm' id='comm' onchange="disable('depot')
select name='depot' id='depot' onchange="disable('comm')
Let's know the outcome of that please.
-George