Copy link to clipboard
Copied
I have a form with 2 pages. On page 1, there's a field for First Name, a field for Middle Initial, and a field for Last Name. On page 2, there's a field for "First Name, Middle Initial, Last Name". If someone has already filled out the 3 fields on page 1, I want it to populate into the field on page 2. Also, since some people don't have middle initials I want an "if" statement for if the MI field is empty on page 1 so that it doesn't try to include that value on page 2.
How can I do this? I'm assuming it's a validation script but I don't know on which field to enter the script and what script I would put. Thanks in advance.
Copy link to clipboard
Copied
As custom calculation script of field on 2nd page use this:
var fn = this.getField("First Name").valueAsString;
var mn = this.getField("Middle Initial").valueAsString;
var ln = this.getField("Last Name").valueAsString;
if(fn != "" && mn == "" && ln != "") event.value = fn+" "+ln;
else if(fn != "" && mn != "" && ln != "")event.value = fn+" "+mn+" "+ln;
else event.value = "";
Copy link to clipboard
Copied
If I understand you right, you don't need script for this, just name fields on 2nd page same as fields on 1st page. Whatever you write in fields on 1st page it will be on 2nd page also.
Copy link to clipboard
Copied
The problem is, on page one the items are broken into 3 different field ("First Name", "Middle Initial", "Last Name").
On page 2, there is 1 field with all 3 of those items ("First Name, Middle Initial, Last Name"). I want to populate the form on page 2 by combining the 3 different fields from page 1.
Copy link to clipboard
Copied
As custom calculation script of field on 2nd page use this:
var fn = this.getField("First Name").valueAsString;
var mn = this.getField("Middle Initial").valueAsString;
var ln = this.getField("Last Name").valueAsString;
if(fn != "" && mn == "" && ln != "") event.value = fn+" "+ln;
else if(fn != "" && mn != "" && ln != "")event.value = fn+" "+mn+" "+ln;
else event.value = "";
Copy link to clipboard
Copied
That did it! Thank you!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more