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

Code For Extracting Initials From A Full Name Text Field to Another Text Field

New Here ,
Jan 25, 2018 Jan 25, 2018

Hello!

I'm having trouble with entering a code in Adobe Acrobat X Standard to take the initials from a full name text field to another text field in the form. I'm working on developing an electronic time sheet for my company and we want the field technician's to be able to enter their full name at the top into a fillable field and then the form will take their initials from that field and populate several fields below to "sign off" on their breaks throughout the day. The less effort they have to put into their time sheet, the better this process will work.

Hopefully someone can help!

Thank you,

Janelle

TOPICS
PDF forms
1.3K
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
LEGEND ,
Jan 25, 2018 Jan 25, 2018

I think that you hit the wrong forum, you need the Acrobat forum.

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 ,
Jan 25, 2018 Jan 25, 2018

Thank you! Sorry about that.

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 27, 2018 Jan 27, 2018

[moved from ActionScript 3 to PDF Forms]

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 27, 2018 Jan 27, 2018

What about hyphenated first/last names? For example "Jean-Paul Gaultier". Should it be "J.P.G." or just "J.G."? Or people with multiple last names, like "Frederik Willem de Klerk". Is it "F.W.d.K."? "F.W.D.K.", etc. There are specific rules and customs about how to initialize such names and it's never good to assume or force someone to do it in a way they don't want to. Better have them do it themselves once, and then copy it automatically the rest of the locations where you want it to appear.

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
LEGEND ,
Jan 27, 2018 Jan 27, 2018

Or,

John Wood Campbell Jr. (JWCJ?)

Loudon Wainright III (LWI?)

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
LEGEND ,
Jan 28, 2018 Jan 28, 2018

I would create at least 3 fields, Name.first, Name.MI, and Name.last. I could then extract the first letter from each of the fields and generate the needed initial string. If I needed one field with the whole name, I would just concatenate the 3 fields with a space between the component parts.

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 28, 2018 Jan 28, 2018
LATEST

I think this works:

event.value = this.getField("FullName").value.split(/[\s+\-]/).map(function(a){return a[0]}).join("");

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