Skip to main content
Participant
December 3, 2019
Answered

Extracting 1st 3 letters from one field into another in PDF Form

  • December 3, 2019
  • 1 reply
  • 1404 views

Hello, 

I have developed a PDF form and I need help solving a simple problem. 

 

I have a "Last Name" field at the top of my form and I need to pull the first 3 letters from that field into a different field at the bottom of my form. 

 

For example: 

Last Name; SMITH

3 Letters: SMI

 

I have tried substrings and calculations but I can't get anything to work...

 

Please help! 🙂

This topic has been closed for replies.
Correct answer Thom Parker

Put this in the calculation script for the field that gets the first 3 letters

 

event.value = this.getField("Last Name").valueAsString.substr(0,3);

 

 

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
December 3, 2019

Put this in the calculation script for the field that gets the first 3 letters

 

event.value = this.getField("Last Name").valueAsString.substr(0,3);

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Laura ZAuthor
Participant
December 3, 2019

THANK YOU!!!!