I have been able to retain the value in a listbox in asp when the user submits the form providing the user selects only one value from the list box - but how do I retain more than one value i.e. if the user selects more than one value?

My code at the moment is:

<form name="form2" method="post" action="">
<select name="mnustylisttype" size="5" multiple="MULTIPLE" class="DropdownFields"><option value=''''>-- Select --</option>

<option value="<%=rsDescription("description")%>" <% if Trim(Request.Form("mnustylisttype")) = rsDescription("description") then %>selected<% end if %>><%=rsDescription("description")%></option>
</select> 

<input type="submit" name="Submit2" value="Submit">
</form>

Thanks in advance

I have been able to retain the value in a listbox in asp when the user submits the form providing the user selects only one value from the list box - but how do I retain more than one value i.e. if the user selects more than one value?

My code at the moment is:

<form name="form2" method="post" action="">
<select name="mnustylisttype" size="5" multiple="MULTIPLE" class="DropdownFields"><option value=''''>-- Select --</option>

<option value="<%=rsDescription("description")%>" <% if Trim(Request.Form("mnustylisttype")) = rsDescription("description") then %>selected<% end if %>><%=rsDescription("description")%></option>
</select> 

<input type="submit" name="Submit2" value="Submit">
</form>

Thanks in advance

You carry Primary ID's for each of your listings correct? If this is the case, reply back to me and I will provide the code snippet you need to capture multiple values using check boxes if this would help.

Me too facing the same issue. :( Not able to retain the selected value of the list box. Any suggestions as to how can this be done.

Thanks.

How can we get the multiple selections from the listbox.
Any suggestions or pointers please?

they are comma separated
ie

2,3,4,5
try it and let know

ya, the string is a comma separated string. We just need to get the multiple selections from one of the listboxes adn populate another list box based on the values selected frm the 1st listbox.

Any suggestions?

Thanks

ok u need to populate next drop down but how are u populating it?
i mean through db interaction or just javascript?

We query the database to get teh values for listbox 2 as per teh selected values in the listbox 1.

but listbox2 is not getting populated since the listbox1 is not being iterated properly..so whenever we have multiple selections from listbox1, code breaks and no value is being populated in listbox2. :(

This article has been dead for over six months. Start a new discussion instead.