Forums

ASP

This topic is locked

List Box Hard Question

Posted 28 Nov 2001 23:32:04
1
has voted
28 Nov 2001 23:32:04 Clay Dempsey posted:
I have two list boxes on my form. One with values and one that is empty. The user selects a value from list box 1, clicks the add button and the list box then has a value. The user can do this up to ten times.

The problem that I am having is that I need to pass every item in the second list box to my processing page. Since no items are selected, how do I take every value in it and dimension it to a variable?

Replies

Replied 01 Dec 2001 15:39:29
01 Dec 2001 15:39:29 Joel Martinez replied:
your right, that is a toughy...

OK, I unfortunately don't have time to actually write this code for you, but I can give you pseudocode...hope this helps:

1. write a javscript function that is fired onSubmit
2. this function loops through all the values in the second listbox, and makes a comma delimited string of all the values.
3. Set the value of a hidden form field = the newly created string.
4. submit the form

Now on the server side,

1. use the split function to make an array of the comma delimited string (theArray = split(request("hiddenField","," )
2. do what you wish with the new array.


Joel Martinez [ ]
----------
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/

Reply to this topic