nezbie Posted June 13, 2006 Share Posted June 13, 2006 [code]<script language="javascript"> function doCopy(list1, list2) { for (var i=0; i< list1.length; i++) { if (list1.options[i].selected == true) { var cancopy = true; for (var j=0; j< list2.length; j++) { if (list1.options[i].value == list2.options[j].value) { cancopy = false; break; } } if (cancopy == true) { list2.options[list2.options.length] = new Option(list1.options[i].text, list1.options[i].value, false, true); } } } }</script><form name="notifications_form"><select multiple size=5 name="jakelulista" style="width: 150px;"> <option value="1">1 <option value="2">2 <option value="3">3</select><input type="button" value="Siirrä arvo" onClick="doCopy(document.notifications_form.jakelulista,document.notifications_form.lopullinen);" /><select multiple size=5 name="lopullinen" class="inputFields" style="width: 150px;"></select></form>[/code]Ok, the code is above. It works fine. But, I'd need to pass multiple values in this selection list via the form. Now, when the name is just "lopullinen" it passes the last value in this list. I've tried different things to change this lists name in an array type name, like "lopullinen[]" when it can pass multiple values via the form, but the script stops working.Can someone help me with this, please? Quote Link to comment https://forums.phpfreaks.com/topic/11917-problem-with-passing-multiple-selection-list-values-to-another-one/ Share on other sites More sharing options...
nezbie Posted June 13, 2006 Author Share Posted June 13, 2006 document.notifications_form.elements['lopullinen[]'] solved the problem. Quote Link to comment https://forums.phpfreaks.com/topic/11917-problem-with-passing-multiple-selection-list-values-to-another-one/#findComment-45229 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.