Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


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, Windows

Views

559

Likes

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

Adobe Community Professional , 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 BuffettPosition: MusicianEmployee ID: A1AOutput: Jimmy Buffett, Musician, A1AFor 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...

Likes

Translate

Translate
Adobe Community Professional ,
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.

Likes

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.

Likes

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!

Likes

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
Adobe Community Professional ,
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(", ");

Likes

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