Solved

dropdown list

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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?
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
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…

839 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