Skip to main content
ADVYON
Participant
October 28, 2019
Question

Custom script for dropdown value for PDF Form

  • October 28, 2019
  • 1 reply
  • 347 views

I am working on a form that calculates a bunch of different fields based on a few inputs (for a table top game, pathfider 2e if anyone is interested) I have 6 fields that generate a number (STR, DEX, CON, INT, WIS, CHA). I want to make a drop down in a different section of the form that has those are options, and will pull the number from the original field as the export value. So for instance, if you select STR from the downdown menu, I want that options Export Value to be the vlue from the field "STRMod". 

 

I tried usinng the field name i want to pull as the entry for the export value.

 

I also tried:

this.getField("STRMod").value

 

I also tried:

event.value = this.getField("STRMod").value

 

No avail

 

Any ideas? is this possible?

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
October 28, 2019

Then only way to set the export value of a list item, from a script, is with the field.setItems() function.

Here's the entry for it in the Acrobat JavaScript reference:

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_AcroJS%2FField_methods.htm%23TOC_setItemsbc-19&rhtocid=_6_1_8_31_2_18

 

You can read about programing lists here:

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

and Here (this one has a download exemple that shows how to set list values):

https://acrobatusers.com/tutorials/list_and_combo_in_lc

 

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