Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

move item from listbox 1 to listbox 2

Avatar

Level 3

Hi,

please HELP!!!!

I have 2 listboxes.

Listbox 1 is filled with information from xml. If I select item(s) from Listbox 1, item(s) should be deleted from Listbox1 and moved to Listbox 2.

I tried this code. The addItem code works, but if I add the deleteItem code, nothing works anymore.

if

(Listbox1.boundItem(Listbox.Description.rawValue) == "") {

Listbox2.addItem(Listbox1.rawValue);

Listbox1.deleteItem(Listbox1.selectedIndex);

}

I would really appreciate if you could help on this!!!!!!!!

thanks,

Diana

8 Replies

Avatar

Level 3

Hi Srini,

thanks for trying for help!!!!

this code doesnt work, i applied your example even i dont need the clear and sort items code, but just to check if it works, but it doesnt.

the items are not even populated.

What can I do?

if

(SOLWindow.Description.selectedIndex >= 0){

SOLlist.addItem(SOLWindow.Description.rawValue);

SOLWindow.Description.deleteItem(SOLWindow.Description.selectedIndex);

//Sort Items

var newList = new Array();

var nItems = SOLlist.resolveNodes("#items.#text[*]");

var count = nItems.length;

var listCount = 0;

for (var i = 0; i <count; i++) {

newList[i]

= SOLlist.getDisplayItem(i);

}

newList.sort();

SOLlist.clearItems();

for (var i = 0; i< newList.length; i++) {

SOLlist.addItem(newList[i]);

}

}

I appreciate your help!!!!!

thanks,

Diana

Avatar

Level 10

Send your form to LiveCycle9@gmail.com with the XML associated with it..So it will be easier to diagnose..

Please mention where the issue is inside the form..

Thanks

Srini

Avatar

Level 3

Hi Srini,

I just tried in the first line instead of:

if (SOLWindow.Description.selectedIndex >= 0){

my code:

if

(SOLlist.boundItem(PAGE2.SOLWindow.Description.rawValue) == ""){

the selection works again, but it doesnt delete the selected items.

What is wrong with that?

Thank you again for your help!!!

Diana

Avatar

Level 10

Diana,

       Here is a sample code that might help you.

      Place two ListBoxes on your form. Place this code in a click event of a button which moves the items from ListBox1 to ListBox2.

      You can replace the ListBox names with the ones you have on your form. Both listboxes are not checked the Multiselect check box option.

 

       var intSelectedItem = ListBox1.selectedIndex;
       ListBox2.addItem(ListBox1.getDisplayItem(intSelectedItem));
       ListBox1.deleteItem(intSelectedItem);

Thanks

Srini

Avatar

Level 3

Hi Srini,

I just send you on your email address my form with xml.

I tried your last code that you posted here, but it still doesnt work, it's so weird. I dont understand it.

I hope we can find a solution!!!

Thank you so much for your patience!!

Diana

Avatar

Level 3

Hi Srini,


thank you sooo much for putting effort to help me on the form!!!!!!

The form works fantastic, the only 1 question that I have is, that now I can only select one item at the same time instead of multiple items.

I tried it and checkmarked allow multiple lines in the listbox but it doesnt work.

Is there a way how to still be able to select multiple items?


Thank you so much for your help again!!!

Diana