?
Solved

Multiple PreSelected Dropdown

Posted on 2007-10-12
5
Medium Priority
?
254 Views
Last Modified: 2010-08-05
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
Comment
Question by:cybertrickle
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:ncoo
ID: 20068220
<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
 
LVL 16

Expert Comment

by:DrNikon224
ID: 20068227
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
 
LVL 15

Expert Comment

by:ncoo
ID: 20068234
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
 
LVL 16

Expert Comment

by:DrNikon224
ID: 20068241
@ncoo

Are you intentionally using </value> instead of </option>? Typo maybe?
0
 
LVL 15

Accepted Solution

by:
ncoo earned 2000 total points
ID: 20068273
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses
Course of the Month16 days, 4 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question