Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

deleteItem on selectedIndex only deletes first Item in listbox

$
0
0

Hello. I am trying to create listbox that will be populated by entries from a numeric field using a button. I will have 3 buttons. An 'Add Item' button, a 'Remove Selected Item' button and a 'Clear All Items' button. I have having difficulty with the 'Remove Selected Items' button.

 

On the click event for the remove button, I have written some simple javascript code to delete the selected index item that should read the selected item from the listbox and then delete it.

 

ListBox1.deleteItem(ListBox1.selectedIndex)

 

This isn't happening. I have noticed that, when I click on my item in the list box, it gets highlighted in blue. When I go and subsequently click on the remove button, all of a sudden, all of the items in the listbox gets highlighted and then the first item in the list gets removed regardless of which items I had chosen. My feeling is, that the all the items in the listbox is getting selected when I press the button and so some sort of default behavior of the selectedItem method makes it grab the first item in the list. I ahve no other code on that button nor do I have any code for the listbox at all.

 

Not sure if I am setting up my button properly. maybe this is not the right function? Has anyone experienced this behavior?

 

Couple other things worth noting. The list box is empty. I do not pre-populate it with default items.

 

I tested the remove button by adding some default items to the list and then selecting one and then clicking the button. This seems to work so I am not sure why my user driven data is different from default data.


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>