kiwistag
asked on
JavaScript match Drop Down Box list
I've been working from the instructions from JS Example Site and only need to copy the result to another drop down box.
The need for this is to cross-reference records and import as required. There are a few other drop down boxes but I want each one to be able to be updated individually.
So far I have the below code in.
I had it working in one way but only with the Radio button and it seemed to be 1 record off.
I also want to run it from an input button instead of Radio.
Any ideas?
The need for this is to cross-reference records and import as required. There are a few other drop down boxes but I want each one to be able to be updated individually.
So far I have the below code in.
I had it working in one way but only with the Radio button and it seemed to be 1 record off.
I also want to run it from an input button instead of Radio.
Any ideas?
<head>
<script type="text/javascript">
function dataDD_copy()
{
if(document.form1.copyi[0].checked){ //Using copyi as another script does just textboxes with 'copy'
for(i=document.form1.impRegionID.options.length-1;i>=0;i--)
{
if(document.form1.impRegionID.options[i].selected)
document.form1.ExistRegion.options[i].selected=true;
}
}
}
</script>
</head>
<body>
<form name="form1">
.....
<select name="impRegionID">
<option value="1">North</option>
<option value="2">Region X</option>
<option value="3" selected>Region Y</option>
<option value="4">Region Z</option
</select>
<!-- input type="button" name="copyi" value="->" onclick="dataDD_copy()"; --> **** Would prefer to run from a button over a Radio select
<input type="radio" name="copyi" value="yes" onclick="dataDD_copy()";>Update
<select name="ExistRegion">
<option></option>
<option value="1">North</option>
<option value="2">Region X</option>
<option value="3">Region Y</option>
<option value="4" selected>Region Z</option
</select>
....
</form>
</body>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great help.
ASKER
Open in new window
It also seems that the JS won't accept if there is already a selected record in ExistRegion as it then chooses the record prior. (in one trial..)