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

Combining 2 Fields ("First Name" and "Last Name") into ("Full Name")

Participant ,
Apr 09, 2023 Apr 09, 2023

I found this script:

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

 

Problem is, if you go back and change the names in the "First Name" field, and "Last Name" field, it doesn't update the "Full Name" field.

Oh, By the way, I'm using Adobe Acrobat 9 Standard.

Also, does anyone know if there is still a newer version with a "one time" fee rather than a subscription?

TOPICS
Create PDFs , PDF forms
959
Translate
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
1 ACCEPTED SOLUTION
Participant ,
Apr 10, 2023 Apr 10, 2023
LATEST

Thank you, Nesa, I tried the script under the "Format" Tab and under the "Validate" Tab,

but I never tried it under the "Calculate" Tab.  YOUR SUGGISTION WORKS GREAT !!!

One more question (if you don't mind): What if the Person's Name has a Middle Initial?

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

But, if there is "No" Middle Initial, there will be 2 spaces between the First and Last Name

Similarly, I have a "Suffix" field, (ex. John Q Public, Sr.)

I'd like a comma if there IS a suffix, but NO comma if there is no suffix.

Is this possible?

Sorry, I should have included this with my initial question of First and Last Name.

View solution in original post

Translate
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 ,
Apr 09, 2023 Apr 09, 2023

Where does you use the script?

Translate
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 ,
Apr 09, 2023 Apr 09, 2023

Use script under 'Calculate' tab as 'Custom calculation script' in a "Full Name" field.

Translate
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
Participant ,
Apr 10, 2023 Apr 10, 2023
LATEST

Thank you, Nesa, I tried the script under the "Format" Tab and under the "Validate" Tab,

but I never tried it under the "Calculate" Tab.  YOUR SUGGISTION WORKS GREAT !!!

One more question (if you don't mind): What if the Person's Name has a Middle Initial?

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

But, if there is "No" Middle Initial, there will be 2 spaces between the First and Last Name

Similarly, I have a "Suffix" field, (ex. John Q Public, Sr.)

I'd like a comma if there IS a suffix, but NO comma if there is no suffix.

Is this possible?

Sorry, I should have included this with my initial question of First and Last Name.

Translate
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