PDA

Click to See Complete Forum and Search --> : Basic ? about drop down box


dndstef
Jun 6th, 2000, 02:02 AM
I want to display the selected items of a multiple option
drop down box but i don't know how.

as an example
i have 5 items in my drop down box
item1
item2 <- Selected
item3
item4 <- Selected
item5

And i want to be able to display something like
You chose :
-item2
-item3

Can some one help me?

dvst8
Jun 6th, 2000, 02:39 AM
all the selected items form a collection.

you access these items as follows:

myString = Request.form("listname")(2)

which will give you the second selected item.

Here's a little code which will populate an array with all the selected items in a list:


<%

Dim arrayOptions()
intCount = 0

For Each SubKey in Request.form("list1")

ReDim Preserve arrayOptions(intCount + 1)
intCount = intCount + 1
arrayOptions(intCount) = Request.form("list1")(intCount)

Next

%>


you can then loop through this array to get all the selected items.

Hope this helps!!

dvst8

dndstef
Jun 9th, 2000, 12:36 AM
Thanks it helped very much!

But now i have another question!

How can i by clicking on a button select all items
of the multiple option drop down box?