Skip to main content
Participating Frequently
April 16, 2020
Question

ListBox to CheckBox help

  • April 16, 2020
  • 2 replies
  • 393 views

Hello,

 

I am hoping to get some suggestions for the following:

 

Example: I have a ListBox with multiple selections enabled. Let's say the values are ITEM1, ITEM2, ITEM3, ITEM4. Now say I have 4 CheckBoxes (Labelled: ONE, TWO, THREE, FOUR) that will be checked depending on which ListBox items are selected. So if the user selects ITEM2 and ITEM4 from the ListBox, the respective CheckBoxes TWO and FOUR will be checked.

 

Any idea on how to accomplish this? I am sorry if this is a novice question however I am not the most advanced user.

 

Thank you

Louis

This topic has been closed for replies.

2 replies

LabrecloAuthor
Participating Frequently
April 17, 2020

Thank you Thom. I have some knowledge of JS. I have been learning as I go and have quite a bit of script in my forms. I will take a look at what you sent.

 

Thanks again

Louis

Thom Parker
Community Expert
Community Expert
April 17, 2020

What do you know about JavaScript?  The solution you need is a bit complex, and if you don't know JS you'll never get there.  The key piece of info you need for a solution is that the indexes of the selected items are in the "currentValueIndices" property of the List Field.  You'll need to come up with a way to relate the items in the list box to the checkboxes. A good way to do this is to incorporate the values of the list items into the names of the checkboxes. 

 

I would suggest you start by reading this article:

https://acrobatusers.com/tutorials/list_and_combo_in_lc/

 

You'll find more information and tons are examples and tutorials on programming lists here (paid for site):

https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often