Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iterating thru selected values in SELECT 2

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
How do I obtain the multiple values selected from a drop down box?
Any help highly appreciated

thank you
 
I am pretty sure I have had this work before, but right now it's not working for me, but my computer is acting all pi**y right now anyways so it may be me.

anyways...the select box should be basically a comma delimited variable. So, you can use the split command and that will give you an array.

dim tmpArray
dim i

tmpArray = split(msgbox, ", ")

for i = lbound(tmpArray) to ubound(tmpArray)
' do whatever
next


Something quite similar to that should work I believe. I appologize in advance if I am wrong and that does not work.

HTH

Mike
 
Try this ...

<html>
</head>
<script language=&quot;vbscript&quot;>

Sub disp()
Dim i
Dim itms

For i = 0 to (mulSel.Options.Length-1)
if mulSel.Options(i).selected Then itms = itms & _
mulSel.Options(i).value & &quot; - &quot; & _
mulSel.Options(i).Text & vbcrlf
Next

msgbox itms

End Sub

</script>
</head>
<body>
<select id=&quot;mulSel&quot; size=&quot;03&quot; multiple>
<option value=&quot;1&quot;>Music</option>
<option value=&quot;2&quot;>TV</option>
<option value=&quot;3&quot;>Books</option>
</select>
<button onclick=&quot;disp()&quot;>Submit</button>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top