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

From name field to another name field

New Here ,
Jan 31, 2018 Jan 31, 2018

I have a form field which will be filled "Name and Last Name". The second page of the pdf I have another form field that needs to be filled only the last name of the first field.

For example:

Filed one: "John Doe"

Second fiiled: Dear Dr. Doe, and the rest of the copy.....

Can you plase Help...

TOPICS
PDF forms
443
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 ,
Jan 31, 2018 Jan 31, 2018

You'll need a script to split the name into pieces.

Assuming the name of the field on the 2nd page is "LastName",put this code into the custom format script for the first field.

this.getField("LastName").value = event.value.split(/\s+/).pop();

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Feb 01, 2018 Feb 01, 2018

You need to be careful doing that. Many people have multiple first names, or multiple last names, and guessing what a person's last name is could be problematic. I would let the users fill in their names separately and then combine them to a single field, instead.

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
New Here ,
Feb 01, 2018 Feb 01, 2018

Thank you, I will try this. But I am new to Scripting. Working sample of PDF would be really helpful for me. If you can.

I really appreciate your help.

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
New Here ,
Feb 01, 2018 Feb 01, 2018

Thank you so much for your reply. If you don't mind, I am attaching the link to a working demo file. Can you take a look and fix it.

Form-Test

Thanks again.

Nick-

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 ,
Feb 01, 2018 Feb 01, 2018

Each field needs to have a unique name, for starters.

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 ,
Feb 01, 2018 Feb 01, 2018

Yeah, I thought about writing something about the pitfalls of this technique, but it's too complicated for this thread. Better to just do it and see how it works. It always returns the last entry, even it it's "Jr", or "the 3rd". In my view anyone who includes post titles in their names deserves to be called Mr 3rd

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Feb 01, 2018 Feb 01, 2018

It's not only "Mr. 3rd" that will have this problem. In many places multiple first names are common, as well as multiple last names, and there's really no 100%-proof way of distinguishing between them. It's not worth taking the risk of pissing off a bunch of people just for this small automation. Much better to do it the other way around, IMO.

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 ,
Feb 01, 2018 Feb 01, 2018
LATEST

I agree.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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