I have a bit of a problem and any help would be much appreciated.
Problem: I have two dropdown list boxes with same data(all data
driven).
These are used for two separate entries.
For every entry you cannot choose the same value twice.
For example, I cannot choose for entry 1 the same
value in both selection boxes (gqCategory1Entry1 and
gqCategory2Entry1)
This part works.
The second entry is the problem: When I choose a value for Entry
Two that is the same as in entry one it thinks that "Dubplicate
Divisons have been selected").
WHen in fact these are two separate entries.
Code:
<head>
//Enry number one...no Duplicates
function check_selection(elt){
//check for duplicate selections
var form=elt.form;
var name=elt.name;
var index=elt.selectedIndex
//loop through all form elements
for(var i=0;i<form.length;i++){
var_name=form.elements[i].name;
var_index=form.elements[i].selectedIndex;
if(var_name.substring(0,16)!='gqCategory'){
// if form element is not the current element
// and the division name is the same, raise
//error message
if(var_name!=name&&index!=0&&var_index==index){
alert(var_name);
alert("Duplicate divisions selected! Please choose again.");
elt.selectedIndex=0;
elt.focus();
return false;
}
}
}
return true;
}
</head>
Entry one:
<select name="gqCategory1Entry1" maxlength="48" tabindex = 20
onChange="check_selection(this)" maxlength="48">
<option value="-1"> ---Select a Category---
<option value=1.1 > Division - 1.1 - Internet Sites
<option value=1.2 > Division - 1.2 - Intranet Sites
<option value=1.3 > Division - 1.3 - Interactive communication
</select>
<select name="gqCategory2Entry1" maxlength="48" tabindex = 20
onChange="check_selection(this)" maxlength="48">
<option value="-1"> ---Select a Category---
<option value=1.1 > Division - 1.1 - Internet Sites
<option value=1.2 > Division - 1.2 - Intranet Sites
<option value=1.3 > Division - 1.3 - Interactive communication
</select>
------------
Entry TWO:
<select name="gqCategory1Entry2" maxlength="48" tabindex = 20
onChange="check_selection(this)" maxlength="48">
<option value="-1"> ---Select a Category---
<option value=1.1 > Division - 1.1 - Internet Sites
<option value=1.2 > Division - 1.2 - Intranet Sites
<option value=1.3 > Division - 1.3 - Interactive communication
</select>
<select name="gqCategory2Entry2" maxlength="48" tabindex = 20
onChange="check_selection(this)" maxlength="48">
<option value="-1"> ---Select a Category---
<option value=1.1 > Division - 1.1 - Internet Sites
<option value=1.2 > Division - 1.2 - Intranet Sites
<option value=1.3 > Division - 1.3 - Interactive communication
</select>