Skip to main content
mcolvin2005
Participant
September 30, 2017
Answered

Setting a form field to auto fill based on another field

  • September 30, 2017
  • 2 replies
  • 11224 views

First of all i'm new to the calculations in Acrobat but i'm trying to figure out two things

First is i'm trying to Field A and Field B to equal field C

example Field A = Hello Field B=2014 so Field C would equal Hello2014

2nd I have a topaz signature pad that i capture signatures with and i would love to have a script that will auto save the file base on what is in Field C from above after the signature was captured or even open a save as box

This topic has been closed for replies.
Correct answer try67

1. Use this code as the custom calculation script of Field C:

event.value = this.getField("Field A").valueAsString + this.getField("Field B").valueAsString;

2. That's more complicated. To save the file without user interaction requires installing a script on the local machine.

See: https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript

The alternative is to present the user with the desired file name, and then open that Save As dialog and hope they use it.

2 replies

Participant
April 3, 2020

try67 - You are brilliant!! - This custom calculation allows the developer to set alternative text formatting such as beeing bold an in a smaller font (set in the property Dialog box). If you simply duplicate the text field then it takes on the text formating of the parent field. I know that you know this, however, other newbies might not so this is a great solution along with concatenating fields together. Thank you again! 🙂 

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
September 30, 2017

1. Use this code as the custom calculation script of Field C:

event.value = this.getField("Field A").valueAsString + this.getField("Field B").valueAsString;

2. That's more complicated. To save the file without user interaction requires installing a script on the local machine.

See: https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript

The alternative is to present the user with the desired file name, and then open that Save As dialog and hope they use it.

Inspiring
June 2, 2022

I have a similar situation, but I want to incorporate formating and what happens if a field is left blank.
I'm creating a business card template that the person fills in fields "Name", "Pronouns", "Designation_1" and "Designation_2"

I have a read only field that will populate from the other fields in the same order. The designation fields are drop downs with the first option being "-"

 

I have the script written as: 

//Populate text from fields
event.value = this.getField("Name").valueAsString + " " + this.getField("Pronouns").valueAsString + " " + this.getField("Designation_1").valueAsString + ", " + this.getField("Designation_2").valueAsString;

 

It's missing some things. I want the designation to not appear at all if the person selects the "-" option. As well I don't want the comma to appear between the designations unless anything either than "-" is selected in "Designation_2".

 

The designations also need to be formated to 5pt where the rest of the text in the field is 8pt.

 

Can anyone assist me with this?

Inspiring
June 9, 2022

You want to edit the text in those fields, or the text copied from them and used in the single, combined string?


Should I start a new conversation regarding this?