Skip to main content
Participating Frequently
April 9, 2019
Answered

Concatenate form fields (Acrobat Pro DC)

  • April 9, 2019
  • 2 replies
  • 5961 views

I need to create a "calculated" field in Acrobat Pro DC that will concatenate two previously entered fields:

Field: Address_1 will contain "Street number and Name" (Example: "1 Fred Crescent")

Field: Address_2 will contain "Town/Suburb, State, Postal Code" (Example: "Some Town, State Code")

I need Field :Full_Address to contain "Address_1" a comma and a space then "Address_2" (Example: "1 Fred Crescent, Some Town, State Code")

Being totally ignorant in programming, how can I achieve this?

This topic has been closed for replies.
Correct answer TᴀW

Try this as a custom calculation script attached to the Full_Address field:

var s = this.getField("Address_1").valueAsString + ", " + this.getField("Address_2").valueAsString;

event.value = s.replace(/^, |, $/g, "");

Ariel

2 replies

Participant
October 23, 2019

I previously created a concatenate field for postal codes, not using script, but cannot recall how to do it or where i found the direction. It has seven blocks for text and a space and is all contained within one field.  Under property options, it is marked Comb of 7 characters. Can anyone help? 

try67
Community Expert
Community Expert
October 23, 2019

I don't think it's possible without a script. The built-in calculation options only work with numbers, not strings.

Participant
October 23, 2019

I think i was mistaken. It is not intended to be concatenate, but with connected characters that flow from one text box to the next....connected, not combined.

TᴀW
TᴀWCorrect answer
Legend
April 9, 2019

Try this as a custom calculation script attached to the Full_Address field:

var s = this.getField("Address_1").valueAsString + ", " + this.getField("Address_2").valueAsString;

event.value = s.replace(/^, |, $/g, "");

Ariel