mkaz.com home photography web dev personal about

JavaScript : Select Menu List

You can use two multiple-select menus to make it easy for someone to create a list, by moving items from one menu to the other. I found this useful when creating a distribution list where you have a set of people available to go into that list.

Here is an example:



 

As always, View the Source in your browser to see how this is done.

If you are going to submit this form to process the list you will need to select all the items in the list you want. Only items marked selected are sent with a form. You can do this using the following code:


for (i=0; i<m1.length; i++) {
m1.options[i].selected = true;
}

This will select all of the items in menu1, and will then be sent with the form data. Remember that you will need to process multiple values being sent with one variable.