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

How to set value of a PDF form field using values from other fields in the same PDF form

New Here ,
Sep 03, 2022 Sep 03, 2022

Copy link to clipboard

Copied

I want to use the values from a "first name" and "last name" to populate another field called "full name" (with spaces between the two fields).

I found the below script, but my javaScript skills are lacking and I don't know how to add extra values:

event.target.value =
this.getField("first name").value;



I am seeking guidance on how to add more than one field. I would greatly appreciate your assistance.

 

FYI, this is the original post I credit the above script to.

TOPICS
Acrobat SDK and JavaScript

Views

112

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 ,
Sep 03, 2022 Sep 03, 2022

Copy link to clipboard

Copied

LATEST

Use this as 'Custom calculation script' of "full name" field:

var first = this.getField("first name").valueAsString;
var last = this.getField("last name").valueAsString;
if(first&&last)
event.value = first+" "+last;
else
event.value = "";

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