Solved

dropdown list

Posted on 2000-04-25
4
173 Views
Last Modified: 2010-04-09
i written code for dropdown list which is multiple selecion list.what i need is i want to refer each selected item by its name so that i can use that name in somewhere else.
i am using name attribute for option tag also, i donot know option tag has name attribute.
<select name=menu multiple>
buffer.append("<OPTION name=on24url"+i+" value="+urlroot+sChon24[i]+">Consumer: health</OPTION>");
</select>

why i need this is i used check box
<input type=checkbox name=on24url"+i+" value="+urlroot+sChon24[i]+"> iam using this one in the following code.
sChurl[i]=portal.getUser().getProperty("on24url"+i);
iam trying to implement drop down list instead of checkbox.
i need solution immediatly
0
Comment
Question by:kyama1
  • 2
4 Comments
 
LVL 2

Expert Comment

by:freshmeat
ID: 2749795
u don't need to put name in "option"
only let the value is unique, that is enough i think
0
 
LVL 8

Expert Comment

by:xabi
ID: 2750410
the code of a multiple select is this:

<select name="myselect" multiple>
 <option value="value1">text1</option>
 <option value="value2">text2</option>
 <option value="value3">text3</option>
 <option value="value4">text4</option>
</select>

so you must generate in this way:

<select name=menu multiple>
buffer.append("<OPTION value="+urlroot+sChon24[i]+">Consumer: health</OPTION>");
</select>

and if you need to refer to the selected items in the same page you can use javascript:

<script language="javascript">
<!--
idSelect = document.my_form_name.myselect
for (iTmp=0; iTmp < idSelect.options.lengt; iTmp++) {
  if (idSelect.options[iTmp].selected) {
    alert("Option selected " + idSelect.options[iTmp].text + " value: " + idSelect.options[iTmp].value)
  }
}
//-->
</script>

xabi

ps: Please write me if you need more help or my answer is now correct.
0
 
LVL 8

Accepted Solution

by:
xabi earned 75 total points
ID: 2750413
the code of a multiple select is this:

<select name="myselect" multiple>
 <option value="value1">text1</option>
 <option value="value2">text2</option>
 <option value="value3">text3</option>
 <option value="value4">text4</option>
</select>

so you must generate in this way:

<select name=menu multiple>
buffer.append("<OPTION value="+urlroot+sChon24[i]+">Consumer: health</OPTION>");
</select>

and if you need to refer to the selected items in the same page you can use javascript:

<script language="javascript">
<!--
idSelect = document.my_form_name.myselect
for (iTmp=0; iTmp < idSelect.options.lengt; iTmp++) {
  if (idSelect.options[iTmp].selected) {
    alert("Option selected " + idSelect.options[iTmp].text + " value: " + idSelect.options[iTmp].value)
  }
}
//-->
</script>

xabi

ps: Please write me if you need more help or my answer is now correct.
0
 

Author Comment

by:kyama1
ID: 2751925
i think i got idea, but iam not sure it will work for my case.anyway thanks for your help. if i need help i will mail you again
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now