Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox selection

Status
Not open for further replies.

JennyLu

Programmer
Joined
May 31, 2001
Messages
7
Location
US
I have two listbox on one page to let user make selection from one to the other. Could you tell me how to make those buttons &quot;<&quot;, &quot;>&quot;, &quot;<<&quot;, &quot;>>&quot; working? Thanks.
 
Yes, THANKS A LOT!!!
 
So how do you get the values that are listed in &quot;list2&quot;. Request.form(&quot;list2&quot;) will not return the values in the list box.
 
No, you would use:

document.form.list.options[document.form.list.selectedIndex].value

will return the &quot;value&quot;


document.form.list.options[document.form.list.selectedIndex].text
will return the text(value as we call it)


ie. <option value=&quot;12&quot;>Alabama</option>

.value will return 12
.text will return Alabama

Hope it'll help ;-) Have Fun...

Sharky99 >(::O>
 
Yes, I understand the differences between the &quot;value&quot; and &quot;text&quot; property, but with the example you gave with the two list boxes (list1 and list2), when the &quot;submit&quot; button is clicked, how do I read the &quot;values&quot; that I've moved over to the right list (list2)? How are the multiple &quot;values&quot; posted from that list box?
 
I think the easiest way would be to make a hidden field with an, initially, empty value. Then as you move items from list 1 to list 2, simply append them to the field with a simple comma or semicolon to delimit the entries. This hidden field could then be returned with the submit and processed at the server side.

Griff
 
Hi, sorry for now i only had time to add this(in red)

for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
no.selected = true;
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
no.selected = true;
tbox[c] = no;
}

I'll figure out something later tonight or tomorrow.
(working on a project right now)

Sorry but for now it's the best i can do...

Hope it'll help ;-) Have Fun...

Sharky99 >(::O>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top