I have hands on in handling two listboxes, one in the left and one in the right.
I have a requirement where I have 4 listboxes in the left and if I select the items from the listboxes and press the right >>, it moves to the final listbox.
Now I find it difficult to move the values from the final listbox to respective left listboxes when I press <<.
Please someone guide on this.This message has been edited. Last edited by: Ramya,
I have implemented the same with the two listbox in the left(leftlistbox1, leftlistbox2) and one in the right(finallistbox).
What I did, is just capture the id of selected value listbox(the one whose in the left) and then pass that value to the final listbox(in the right).
1) Select the value from the left listbox and capture the id of that listbox at onchange event
2) On clicking >> button just append that selected listbox id to the value with '~' separated and move it to the final listbox
var newOption = new Option(); // Create a new instance of ListItem
newOption.text = Source.options[Source.options.selectedIndex].text;
newOption.value = Source.options[Source.options.selectedIndex].value+'~'+listbox_name;
3) Now select the value from the final listbox(in the right) and at onchange event, separate the value and id with '~' separated
var e = document.getElementById('finallistbox');
var dflSel = e.options[e.selectedIndex].value;
4) On clicking << button just check into which listbox the value should move
else if (listbox_name=='leftlistbox2')
You can implement the same with 4 list boxes in the left. I also have the implemented HTML, if you require, just share me your personal id.
WebFOCUS 7.7 , 8.0, 8.1
Excel, PDF, HTML
Thanks so much. Its really helpful.Would feel better if you can share me the HTML also. My personal ID is firstname.lastname@example.org
The code you have sent me worked good.
I have dropped you an email saying its not working fine for 3 listboxes and this morning I have done some modifications and its working fine.
Now I am into one more challenge.
Moving values from listbox1 to target, listbox2 to target and listbox3 to target is fine.
Now the challenge is, selecting values from all the three listboxes and making it move to target in a single click.
If anyone has any idea, please come up with.
Finally got them working.
I have introduced the array concept and kept appending the array with values I selected from multiple listboxes and finally populated the target listbox with array values.
Thanks all for your help.
Edit your first post as 'Solved'.
Good One Ruchika.
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
|Powered by Social Strata|