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

Adobe Form Javascript help - Service Agreements

Community Beginner ,
May 08, 2022 May 08, 2022

Copy link to clipboard

Copied

Hey All!

 

I'm having some trouble getting form fields to work with javascript between 3 PDF forms that our business uses.

 

To give some context, we have a service request form that is used to collect the data. All the form names and replicated throughout the forms, however, some of the fields need to be merged. for example, on the service request, the client's address is requested across 5 fields. "Address_2" isn't always filled.

AbbySzczerbanik_0-1652062457339.png

The data from the Service Request form is then exported to a data file which we use to import onto our Service Agreements and Renewals.

The form field on our Service Agreements and renewals is a singular field, as below.

AbbySzczerbanik_1-1652062686728.png

I need to somehow merge the data gathered from the service request form as a string in to the above form field.

 

This is also the case for our client's name!

"First_Name" and "Last_Name" are requested as seperate fields on the service request form

AbbySzczerbanik_2-1652062778090.png

I need to then merge these two fields into the one below

AbbySzczerbanik_3-1652062824689.png

labelled "Name_Of_Participant"

 

I have tried the following scripts with no success;

//this was tried as a custom validation scipt on the "Name_Of_Participant" field

{
var aElements = new Array();

var aFields = new Array("First_Name", "Last_Name");

for(var i = 0; i < aFields.length; i++)

{

aElements.push(this.getField(aFields).value);

}

function NotSelectOne(value)

{

return value != "Select one";

}

var aCombined = aElements.filter(NotSelectOne)

event.value = aCombined.join("");
}

 

and

 

//this was tried also as a custom validation script, on the "Address" field

event.value = getField("Address_1").valueAsString + ", " + getField("Address_2").valueAsString + ", " + getField("Suburb").valueAsString + ", " + getField("State").valueAsString + ", " + getField("Postcode").valueAsString;

 

I will reiterate that these are across 3 seperate PDF forms, so I am unsure whether this is doable or not, however any assitsance would be greatly appreciated.

I have attached our service request and renewal blank files for further assistance 🙂

 

 

TOPICS
How to , JavaScript , PDF forms

Views

487

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 ,
May 08, 2022 May 08, 2022

Copy link to clipboard

Copied

LATEST

First you need to set 'disclosed' state of a file you want to import data from to true, by placing this: this.disclosed = true;

as document level script and save file.
I would suggest to use  a button field in file with address field and use this script as that button 'Mouse Up' event:
var cData = app.openDoc("EPM Service Request V4.pdf");

this.getField("Address").value = cData.getField("Address_1").valueAsString + ", " + cData.getField("Address_2").valueAsString + ", " + cData.getField("Suburb").valueAsString + ", " + cData.getField("State").valueAsString + ", " + cData.getField("Postcode").valueAsString;

 

You have named field wrong "Subrub", rename it in your file.

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