Skip to main content
New Participant
February 22, 2023
Question

Need fields to auto populate data from a choice in a dropdown field

  • February 22, 2023
  • 2 replies
  • 1298 views

Hi, I was wondering if there is a way to auto populate  4 different text fields with 4 different values, when you select a certain item from a drop down?

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
February 22, 2023

Read these articles:

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

https://acrobatusers.com/tutorials/change_another_field/

 

This question is asked almost daily. Do a little searching on the forums. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
January 15, 2024

Hi there, I'm hoping someone can help me please, I've been scouring the forums and Internet and can't seem to find an answer to my particular problem.

Like the original poster above I am looking to autopopulate 4 fields after a dropdown box selection. In my case it is the 2nd dropdown box of 2, where the 1st dropdown box determines the choices in the 2nd.

Using the 2 articles above,

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

https://acrobatusers.com/tutorials/change_another_field/

I have managed, through a lot of trial and error, to figure out how to get this working.

My issue/problem lies with me wanting to have multiple rows of the same 2 dropdown boxes and 4 autopopulated field boxes. Whenever I try to set that up the best I can come up with is that both dropdown boxes work correctly but the text fields all give the same data (the data for the first row), on each of the subsequent rows even if the dropdown choices are different. I can't seem to figure how to get them working independantly.

For clarification: Dropbox 1 is a choice of magic school, Dropbox 2 is a choice of spell from the previously chosen school in Dropbox 1. The 4 field boxes represent the 'Casting Time', 'Duration', 'Type' and 'Ingredient' of the spell chosen in Dropbox 2.

I can get one line of this working correctly, where all 4 text boxes correctly display the information of the chosen spell but cannot figure out how to get each subsequent spell chosen in the next row to display the information independantly.

Any help at all would be gratefully received as I'm trying to set up a form fillable character sheet for a typing impaired person.

Jim

Nesa Nurani
Community Expert
January 15, 2024

Give fields unique name, for example:

1st row:

Dropbox1.row1, Dropbox2.row1, Casting Time.row1, Duration.row1, Type.row1, Ingredient.row1

2nd row:

Dropbox1.row2, Dropbox2.row2, Casting Time.row2, Duration.row2, Type.row2, Ingredient.row2

...etc

ls_rbls
Community Expert
February 22, 2023

Hi,

 

Yes you can, you must employ a JavaScript script.