retrieving multiple values from a combobox in vbs by anonymous
anonymous
Tue Mar 02 11:31:39 CST 2004
One way I can think of is to test each option for
its 'selected' property. Maybe something like this ...
<html><head>
<script language=vbs>
sub test
for each opt in cars.options
if opt.selected then s=s & opt.text & " & "
next
s = replace(s & ".", " & .", "")
msgbox "You selected: " & s
end sub
</script>
</head><body>
<SELECT id=cars size=3 multiple>
<OPTION VALUE="1">BMW
<OPTION VALUE="2">PORSCHE
<OPTION VALUE="3" SELECTED>MERCEDES
</SELECT>
<input type=button value="Go" onclick=test>
</body></html>
Tom Lavedas
===========
>-----Original Message-----
>I have a script which creates an instance of IE, with a
form. I have a bunch of controls in there, including some
comboboxes with the "multiple" option, so I want the user
to be able to select more than one choice from those
particular comboboxes.
>The problem is, when I try to retrieve the values using a
GetValue() subroutine, where GetValue =
TheForm.cboGroups.Value (this part is embedded in the html
doc), it returns only the first selection. I have searched
endlessly, and can't find any mention of how to do this in
vbs.
>
>Any suggestions would be wonderful! Thanks!
>.
>