Beaverman
04-05-2004, 04:40 PM
How can I ensure that the same name is not selected more than once across different drop-down menus (i.e. if Tom is selected from dropDownState2, he cannot be selected from dropDownState3).
At present, I can select a checkbox to enable that dropdown, but I also need to stop the same name being selected more than once.
Any help/suggestions would be most welcome
<html>
<head>
<script language="javascript">
function enableDropDown(el)
{
if (document.getElementById('dropDownState'+el).checked)
{
document.getElementById('dropDownList'+el).disabled=false;
}
else
{
document.getElementById('dropDownList'+el).disabled=true;
}
}
//-->
</script>
</head>
<body>
<form id="dropDownForm" name="dropDownForm">
<input type="checkbox" id="dropDownState1" value="on" onclick="enableDropDown(1);">
<select id="dropDownList1" disabled>
<option>Tom</option>
<option>Richard</option>
<option>Harry</option>
<option>Bert</option>
</select>
<input type="checkbox" id="dropDownState2" value="on" onclick="enableDropDown(2);">
<select id="dropDownList2" disabled>
<option>Paul</option>
<option>Fred</option>
<option>Tom</option>
</select>
<input type="checkbox" id="dropDownState3" value="on" onclick="enableDropDown(3);">
<select id="dropDownList3" disabled>
<option>John</option>
<option>Brad</option>
<option>Tom</option>
<option>Paul</option>
<option>Harry</option>
<option>Bart</option>
</select>
</form>
</body>
</html>
At present, I can select a checkbox to enable that dropdown, but I also need to stop the same name being selected more than once.
Any help/suggestions would be most welcome
<html>
<head>
<script language="javascript">
function enableDropDown(el)
{
if (document.getElementById('dropDownState'+el).checked)
{
document.getElementById('dropDownList'+el).disabled=false;
}
else
{
document.getElementById('dropDownList'+el).disabled=true;
}
}
//-->
</script>
</head>
<body>
<form id="dropDownForm" name="dropDownForm">
<input type="checkbox" id="dropDownState1" value="on" onclick="enableDropDown(1);">
<select id="dropDownList1" disabled>
<option>Tom</option>
<option>Richard</option>
<option>Harry</option>
<option>Bert</option>
</select>
<input type="checkbox" id="dropDownState2" value="on" onclick="enableDropDown(2);">
<select id="dropDownList2" disabled>
<option>Paul</option>
<option>Fred</option>
<option>Tom</option>
</select>
<input type="checkbox" id="dropDownState3" value="on" onclick="enableDropDown(3);">
<select id="dropDownList3" disabled>
<option>John</option>
<option>Brad</option>
<option>Tom</option>
<option>Paul</option>
<option>Harry</option>
<option>Bart</option>
</select>
</form>
</body>
</html>