List Box

T

tg

Hi folks, a list box question...

I have a list box where the number of items in the list may be increased by
user activity. When the user clicks the "submit" button I can get the
currently selected item from the following page - no issue here.

How do I gather the listing within the list box - the unselected items?

Thanks in advance
 
J

Jon Spivey

Hi,
The only way I can think of is to put each item in a hidden form field then
access the hidden fields, eg in asp something like
<%
'generate list box and a hidden field for each item
for i = 1 to 20
strListBox = strListBox & "<option>" & i & "</option>"
strHiddenFields = strHiddenFields & "<input type=""hidden"" name=""hidden" &
i & """ value=""" & i & """>"
next
%>
write the list box to the page
<select name="whatever"><%= strListBox%></select>
write the hidden fields
<%=strHiddenFields%>

Now pick up the selected and unselected values on the next page
<%
' write selected value
strSelected = request.form("whatever")
response.write strSelected
'write out unselected items
for i = 1 to request.form.count
if left(request.form.key(i),6) = "hidden" and request.form.item(i) <>
strSelected then
response.write replace(request.form.item(i), "hidden", "") & "<BR>"
next
%>

Cheers,
Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top