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

Modify listbox with checkboxes

$
0
0

Hello,


I'm creating a form for our company to use for equipment requests.  I have a section with checkboxes and a listbox.  The listbox is a summary field which shows the user which items they've selected and what the cost will be.  The desired behavior is for the checkbox to add an item to a listbox, and when the checkbox is unchecked it removes that item from the listbox.  Adding an item works great (ListBox.addItem("Display Text","1"), however I need help with the logic for removing the item from the listbox.  Initially I tried ListBox.deleteItem(x), but it doesn't work the way I need it to.  I think the issue is deleting items by their index number.  For example:

 

Objects:

ListBox2

 

CheckboxA

if (CheckboxA.rawValue != 0 ){

  ListBox2.addItem("Chair - $200","0");

  }else {

  ListBox2.deleteItem(0);

  }

CheckboxB

if (CheckboxB.rawValue != 0 ){

  ListBox2.addItem("Desk- $300","1");

  }else {

  ListBox2.deleteItem(1);

  }

CheckboxC

if (CheckboxC.rawValue != 0 ){

  ListBox2.addItem("Trashcan - $10","2");

  }else {

  ListBox2.deleteItem(2);

  }

 

 

The problem is if you Check CheckboxA and CheckboxB and then uncheck CheckboxA it throws the index off and the checkboxes no longer remove the right item.  Is there a way to delete an item from a listbox by using it's display value rather than index?  Is there another way of going about this?

 

Thanks,

Tom


Viewing all articles
Browse latest Browse all 5571

Trending Articles



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