Skip to main content
timothyk62606366
Participant
February 20, 2020
Question

How can I make multiple text box fields visible based on a List Box's multiple selections?

  • February 20, 2020
  • 1 reply
  • 350 views

The code found here:  https://answers.acrobatusers.com/How-can-I-make-a-field-visible-based-on-a-selection-in-combo-box-q15194.aspx

Is almost what I need, but unfortunately it only allows one text box field to be visible at one time.  I would like the user to select multiple selections and have those selections appear.  I currently have para1, para 2, and para3 text boxes defaulted to hidden.  I have the below code in my List Box.  Issue is that it only works to display 1 selection at a time.  I want the user to be able to select several and then have the selected text box appear.  I have attached my test document.  Any help/feedback much appreciated. Thank you.

 

this.getField("para1").display = event.value=="para1" ? display.visible : display.hidden;

this.getField("para2").display = event.value=="para2" ? display.visible : display.hidden;

this.getField("para3").display = event.value=="para3" ? display.visible : display.hidden;

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
February 21, 2020

For a multi-select list box, the list of selected itemes is accessible through the 

field.currentValueIndices property.

Here's the reference entry. there's an example of how to use it. 

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_AcroJS%2FField_properties.htm%23TOC_multipleSelectionbc-29&rhtocid=_6_1_8_31_1_28

 

You'll find another example file that uses multiple selection here:

(it's on the last page of the "Dynamically Modify Email Submit Address" example)

https://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm

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