Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

dropdown list

Posted on 2000-04-25
4
Medium Priority
?
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 225 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

610 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