• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Combining multiple field entries into one using Acrobat XI Standard

New Here ,
Feb 10, 2018 Feb 10, 2018

Copy link to clipboard

Copied

I am trying to use three form fields to populate one that will be identical at the top of each following page; Name, Position, and Employee ID. i have tried several scripts found with minor modifications but have not been able to make it work. On the first page I have the fields listed above to be entered and for our records keeping it is required at the top of every page. What would be the best method of completing this?

TOPICS
PDF forms

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 10, 2018 Feb 10, 2018

You need to provide more information regarading exactlyhow you want to construct the output from the three input values. An example would be helpful, for example:

Name: Jimmy Buffett

Position: Musician

Employee ID: A1A

Output: Jimmy Buffett, Musician, A1A

For the particular format in the above example, the custom calculation script of the single field at the top of the pages could be as simple as:

event.value = getField("NAME").valueAsString + ", " + getField("POSITION").valueAsString + ", " + getFiel

...

Votes

Translate

Translate
LEGEND ,
Feb 10, 2018 Feb 10, 2018

Copy link to clipboard

Copied

You need to provide more information regarading exactlyhow you want to construct the output from the three input values. An example would be helpful, for example:

Name: Jimmy Buffett

Position: Musician

Employee ID: A1A

Output: Jimmy Buffett, Musician, A1A

For the particular format in the above example, the custom calculation script of the single field at the top of the pages could be as simple as:

event.value = getField("NAME").valueAsString + ", " + getField("POSITION").valueAsString + ", " + getField("EMP_ID").valueAsString;

but with the actual field names that you've chosen. It would be slightly more complicated if you wanted to gracefully deal with blank values, but this might get you started.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2018 Feb 12, 2018

Copy link to clipboard

Copied

This worked perfectly, Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

Hi George,

 

I was looking for a solution to combining multiple fields into one and your answer above was very helpful!! However, I'm wondering how I can use your script above but skip blanks? Thanks in advance!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

LATEST

That requires a different approach. Try this code:

 

var fields = ["Text1", "Text2", "Text3"]; // Replace with actual field names
var values = [];
for (var i in fields) {
	var v = this.getField(fields[i]).valueAsString;
	if (v!="") values.push(v);
}
event.value = values.join(", ");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines