Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved] - Handling multiple listboxes
Go
New
Search
Notify
Tools
Reply
  
[Solved] - Handling multiple listboxes
 Login/Join
 
Gold member
posted
Hi,

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,


WebFocus 7702
HTML
 
Posts: 73 | Registered: January 02, 2012Reply With QuoteReport This Post
Member
posted Hide Post
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).


Steps:
1) Select the value from the left listbox and capture the id of that listbox at onchange event
listbox_name=$(this).attr('id');

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;
var value=dflSel.indexOf('~');
listbox_name=dflSel.substring(value+1, dflSel.length);

4) On clicking << button just check into which listbox the value should move

if(listbox_name=='leftlistbox1')
MoveItem('finallistbox', 'leftlistbox1');
else if (listbox_name=='leftlistbox2')
MoveItem('finallistbox', '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
Windows 7
Excel, PDF, HTML
 
Posts: 13 | Registered: May 31, 2016Reply With QuoteReport This Post
Gold member
posted Hide Post
Dear Ruchica,

Thanks so much. Its really helpful.Would feel better if you can share me the HTML also. My personal ID is ramyagopi88@gmail.com

Thanks,
Ramya


WebFocus 7702
HTML
 
Posts: 73 | Registered: January 02, 2012Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi Ruchica,

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.


WebFocus 7702
HTML
 
Posts: 73 | Registered: January 02, 2012Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi All,

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.


WebFocus 7702
HTML
 
Posts: 73 | Registered: January 02, 2012Reply With QuoteReport This Post
Master
posted Hide Post
Edit your first post to add the text "Solved" to subject line.
 
Posts: 542 | Location: Dearborn, MI | Registered: June 03, 2009Reply With QuoteReport This Post
Member
posted Hide Post
Hi Ramya,
Edit your first post as 'Solved'.
 
Posts: 13 | Registered: May 31, 2016Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Good One Ruchika.


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
 
Posts: 182 | Location: INDIA | Registered: July 11, 2013Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved] - Handling multiple listboxes

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.