HTML Drop Down List with Multiple Selections

I am trying to create a drop down list that will allow to select more than one option.

Using the code below creates a list but that can only be scrolled down with the arrow keys and it not obvious if you don't know. Also I need the selected values to be return as follows

<select size="1" name="Test" multiple>
<option>1</option>
<option>2</option>
</select>

1
2

and not

1,2

Is there any easy way of accomplishing this without using complex code from ASP or Java?
broccoliniAsked:
Who is Participating?
 
Chris StanyonCommented:
You can only have the dropdown if you don't set it to multiple. If you set it to multiple, then the dropdown disappear and you box will be a set number of rows deep. The reason you can only use the arrows is because you have the size set to 1.

Also, to return all the selected values you need to name your <select> as an array. You can then loop through the selected items in your handler script.

<select size="3" name="Test[]" multiple>
	<option>1</option>
	<option>2</option>
	<option>3</option>
	<option>4</option>
	<option>5</option>
	<option>6</option>
</select>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.