Solved

dropdown list

Posted on 2000-04-25
4
178 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 four methods for overlaying images in a container on a web page
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

691 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