Current location: Hot Scripts Forums » General Web Coding » JavaScript » Multiple Select


Multiple Select

Reply
  #1 (permalink)  
Old 04-08-05, 12:33 AM
phppick phppick is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Multiple Select

HI,

I am using this Multiple Select Box code, I have some problem here, when i select one value in 'list1' and click >> the selected value from list1 is disappreaing. I want that value to be reamin in 'list1'.

If i select some 5 values in 'list1' i want to display those in second page.
and i will select one value in 'list2' from those transferred from 'list1'.
The selected value in 'list2' in the Main value.

For example:
if i select below 3 values in 'list1' and i transfer to 'list2'.
Alabama,Arizona,California.

Then i will select 'California' from 'list2', i.e is the main Sales Area.

i want to insert both in second page.. All Sales Areas and Main Sales Area.

Code:
<HEAD>

<SCRIPT LANGUAGE="JavaScript">


<!-- Begin
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
   }
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
   }
}
//  End -->
</script>

</HEAD>

<BODY>

<form name="combo_box">
<table><tr><td>
<select multiple size="10" name="list1" style="width:150">
<option value="12">Alabama</option>
<option value="54">Alaska</option>
<option value="65">Arizona</option>
<option value="45">Arkansas</option>
<option value="2">California</option>
</select>
</td>
<td align="center" valign="middle">
<input type="button" onClick="move(this.form.list2,this.form.list1)" value="<<">
<input type="button" onClick="move(this.form.list1,this.form.list2)" value=">>">
</td>
<td>
<select multiple size="10" name="list2" style="width:150">
</select>
</td></tr></table>
</form>

Thanks in Adavnce.
Jen
Reply With Quote
  #2 (permalink)  
Old 04-08-05, 02:11 AM
af11kcc's Avatar
af11kcc af11kcc is offline
Newbie Coder
 
Join Date: Sep 2003
Location: MX
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Check my example.
See the code there...
__________________
<%= af11kcc %>
Reply With Quote
  #3 (permalink)  
Old 04-10-05, 10:00 PM
phppick phppick is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks

Hi,

Thank You very much. its working fine..

TQ

Jen
Reply With Quote
  #4 (permalink)  
Old 04-11-05, 12:09 AM
af11kcc's Avatar
af11kcc af11kcc is offline
Newbie Coder
 
Join Date: Sep 2003
Location: MX
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
no problem,
__________________
<%= af11kcc %>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulling data from multiple select list bayside2004 PHP 4 12-09-04 07:06 AM
help with multiple select used with php and mysql isaacmlee PHP 2 10-15-04 01:34 PM
javascript multiple select menu for php? isaacmlee JavaScript 1 10-15-04 09:53 AM
Multiple column select box Dr-Leech HTML/XHTML/XML 1 08-30-04 11:27 PM
i have 3 select box this is urgent traceMe JavaScript 0 12-02-03 01:24 AM


All times are GMT -5. The time now is 10:46 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.