Click to See Complete Forum and Search --> : how to get unselected listbox <selected> tag


harisbudiman
09-24-2010, 03:16 AM
hi.. this is my first post :D
need help :confused:

i'm using asp classic and i don't know how to get unselected item from listbox


1st page: mail-form.asp
================================================
<form name="form1" method="post" action="send-mail.asp">

<select id="theSelect" name="theSelect" MULTIPLE >

<option value="1">First Option</option>
<option value="2">Second Option</option>
<option value="3">Third Option</option>

</select>

</form>
================================================

2nd page: send-mail.asp
================================================
<%
'get selected item
dim itemSelected, itemUnSelected
itemSelected = Request.Form("selectedOptions")
%>
================================================


my question is: how to get Unselected Item in send-mail.asp from mail-form.asp?


thx

harisbudiman
09-24-2010, 03:20 AM
sorry, need correction for 2nd page: send-mail.asp

================================================
<%
'get selected item
dim itemSelected, itemUnSelected
itemSelected = Request.Form("theSelect")
%>
================================================

yamaharuss
09-24-2010, 08:49 AM
It depends. is your list a static list and always just 1,2,3?

harisbudiman
09-25-2010, 05:20 AM
It depends. is your list a static list and always just 1,2,3?

no.. it's dynamic
i have include file that retrieve the list from database

yamaharuss
09-25-2010, 06:53 AM
Well, not sure why you would need to know the UNselected values but you will need to run the same query on send-mail.asp that creates the original list in your include, then either create an array or loop through the RS and create an array of all the values that are not included in the request.form return.

You might also be able to come up with some tricky way using Javascript on your form that places the unselected values in a hidden field.

harisbudiman
09-25-2010, 08:15 AM
Well, not sure why you would need to know the UNselected values but you will need to run the same query on send-mail.asp that creates the original list in your include, then either create an array or loop through the RS and create an array of all the values that are not included in the request.form return.

You might also be able to come up with some tricky way using Javascript on your form that places the unselected values in a hidden field.

i've 2 listboxes, first is list of recipients, when user click one of the recipient, they will move to the second list (unselected). that's why i need to know unselected values.

sorry for wrong case i gave earlier, actually i don't need the "Request.Form" return.

thx 4 ur help :)

yamaharuss
09-25-2010, 03:04 PM
This is more of a Javascript question. I would use an Ajax call to populate your second list and return all bot those selected in the first list.