I have what I thought was a really simple requirement but it’s proving to be trickier than expected:
The problem seems to be with multiple selections in select boxes.
The select boxes are called “test1” and “test2”.
On pressing a button, I need the selected items in “test1” to be selected in “test2”
I’m using part of a javascript kindly provided here by JMRKER in response to a similar issue:
[code=php]
function iterate2() {
var picked = ”;
for (i=0; i<document.getElementById(‘test1’).options.length; i++) {
if (document.getElementById(‘test1’).options[i].selected == true) { document.getElementById(‘test2’).options[i].selected = 1 }
}
}
This works – to an extent! ?
The behaviour I observe is that this only copies the last selected option (ie: furthest from top of the list) from “test1” into “test2” and what I need is all selected options copied.
Help gratefully appreciated!
Vinny