Highlighted

How to concatenate input fields in the PDF form?

Explorer ,
Apr 17, 2020

Copy link to clipboard

Copied

I know this is a very trival question. I tried the solutions presented here but it doesn't seem to work. Maybe I might have done something wrong.

What I want to combine three input fields in my PDF form into just one field..

FieldName 1 = FIRST NAME

FieldName 2 = MIDDLE NAME

FieldName 3 = LAST NAME

Where:

FIRST NAME = John

MIDDLE NAME = Wilson

LAST NAME = Smith

I wish the result in one field with result "John Wilson Smith". If the individual fields have leading or trailing black, I wish that this character be remove also.

 

Thanks in advance for the help.

 

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

What do you mean by "leading or trailing black"?

 

Basically, you can do it using this code as the custom calculation script of your field:

 

event.value = (this.getField("FIRST NAME").valueAsString + " " + this.getField("MIDDLE NAME").valueAsString + " " + this.getField("LAST NAME").valueAsString).replace(/\s+/g, " ");

 

TOPICS
How to, PDF forms

Views

125

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

How to concatenate input fields in the PDF form?

Explorer ,
Apr 17, 2020

Copy link to clipboard

Copied

I know this is a very trival question. I tried the solutions presented here but it doesn't seem to work. Maybe I might have done something wrong.

What I want to combine three input fields in my PDF form into just one field..

FieldName 1 = FIRST NAME

FieldName 2 = MIDDLE NAME

FieldName 3 = LAST NAME

Where:

FIRST NAME = John

MIDDLE NAME = Wilson

LAST NAME = Smith

I wish the result in one field with result "John Wilson Smith". If the individual fields have leading or trailing black, I wish that this character be remove also.

 

Thanks in advance for the help.

 

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

What do you mean by "leading or trailing black"?

 

Basically, you can do it using this code as the custom calculation script of your field:

 

event.value = (this.getField("FIRST NAME").valueAsString + " " + this.getField("MIDDLE NAME").valueAsString + " " + this.getField("LAST NAME").valueAsString).replace(/\s+/g, " ");

 

TOPICS
How to, PDF forms

Views

126

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
Apr 17, 2020 0
Most Valuable Participant ,
Apr 17, 2020

Copy link to clipboard

Copied

What do you mean by "leading or trailing black"?

 

Basically, you can do it using this code as the custom calculation script of your field:

 

event.value = (this.getField("FIRST NAME").valueAsString + " " + this.getField("MIDDLE NAME").valueAsString + " " + this.getField("LAST NAME").valueAsString).replace(/\s+/g, " ");

 

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
Reply
Loading...
Apr 17, 2020 0
Explorer ,
Apr 19, 2020

Copy link to clipboard

Copied

Leading or trailing blank (not black, my apology) are space before and after the input value.

I have tried the solution you have provided and it works perfectly well. Thank you.

More power to you.

 

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
Reply
Loading...
Apr 19, 2020 0
New Here ,
Sep 09, 2020

Copy link to clipboard

Copied

I use a form in pdf where in one page I enter Name in first field and Last Name in 2nd field. I too need to concatenate these two fields on a several other pages - but I do not understand how to do this. I am using the Prepare Form from Adobe Acrobat Pro DC -- can someone please explain step by step how to do this? Thanks, Damaris

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
Reply
Loading...
Sep 09, 2020 0
Most Valuable Participant ,
Sep 09, 2020

Copy link to clipboard

Copied

Same script as above, just adjust the field names as needed. It doesn't matter that they are on different pages.

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
Reply
Loading...
Sep 09, 2020 0
New Here ,
Sep 09, 2020

Copy link to clipboard

Copied

I copied/pasted the formula - but it didn't work --- I'm not sure how to do
this -- I use it in excel with no problems -- pretty simple -- but here it
is more difficult

my field names are

"Name"
"Last"

pretty simple -- I just don't know how to write it.


Thanks for your help.

Damaris

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
Reply
Loading...
Sep 09, 2020 0
Most Valuable Participant ,
Sep 09, 2020

Copy link to clipboard

Copied

Use this:

event.value = this.getField("Name").valueAsString + " " + this.getField("Last").valueAsString;

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
Reply
Loading...
Sep 09, 2020 0
New Here ,
Oct 12, 2020

Copy link to clipboard

Copied

I haven't tried this yet. But I didn't want to be rude and not reply with Thank You! The truth is: I'm probably going to need a step by step ---- for instance --- after I open "the text field properties" where would I enter the code you gave me (event.value = this.getField("Name").valueAsString + " " + this.getField("Last").valueAsString;) ---- In the "calculate" and then "simplified field notation"?  See --- I don't know where to enter the code??? 

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
Reply
Loading...
Oct 12, 2020 0
try67 LATEST
Most Valuable Participant ,
Oct 12, 2020

Copy link to clipboard

Copied

Calculate, then Custom Calculation Script.

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
Reply
Loading...
Oct 12, 2020 0