• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

Multiple PreSelected Dropdown

This code in my understanding should show up as a multiple select dropdown with 3,4,5 preselected.

Why doesn't this work? How do I do this the correct way?

<select name="Assignees"  id="Assignees" MULTIPLE>
<OPTION VALUE="1" > 1
<OPTION VALUE="2" > 2
<OPTION VALUE="3" SELECTED3
<OPTION VALUE="4" SELECTED> 4
<OPTION VALUE="5" SELECTED> 5
<OPTION VALUE="6" > 6
</select>
0
cybertrickle
Asked:
cybertrickle
  • 3
  • 2
1 Solution
 
ncooCommented:
<select multiple="multiple">
<option value="1">1</value>
<option value="2">2</value>
<option value="3" selected="selected">3</value>
<option value="4" selected="selected">4</value>
<option value="5" selected="selected">5</value>
<option value="6">6</value>
</select>
0
 
GarbsTheTurtleCommented:
2 things - first, is this a typo - the <option> tag isn't closed:

<OPTION VALUE="3" SELECTED3

second, all of your options are missing </option> - lines should read like:

<OPTION VALUE="2" > 2 </OPTION>
0
 
ncooCommented:
That will also now validate as XHTML.

<select name="Assignees"  id="Assignees" multiple="multiple">
<option value="1">1</value>
<option value="2">2</value>
<option value="3" selected="selected">3</value>
<option value="4" selected="selected">4</value>
<option value="5" selected="selected">5</value>
<option value="6">6</value>
</select>
0
 
GarbsTheTurtleCommented:
@ncoo

Are you intentionally using </value> instead of </option>? Typo maybe?
0
 
ncooCommented:
Good spot, typos all over the place to night!

Now that will validate as XHMTL!

<select name="Assignees"  id="Assignees" multiple="multiple">
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected="selected">3</option>
<option value="4" selected="selected">4</option>
<option value="5" selected="selected">5</option>
<option value="6">6</option>
</select>
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now