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

Printing the last digits of a textbox

New Here ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

Guys, I have a pretty simple question, but I've no idea about writing command in JS.

The thing I'm trying to do is to print in a textbox the last five digits of another textbox. Something like this:

in my first textbox, I have this serial number: FTFYIOI66779995, and I want to print the last 5 digits: 79995 in other textbox.

Hope I explained myself right And thanks for your help

TOPICS
Acrobat SDK and JavaScript

Views

329

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

correct answers 1 Correct answer

Community Expert , Aug 14, 2019 Aug 14, 2019

If the first field is called "Text1" you can use the following code as the custom calculation script of the second field:

event.value = this.getField("Text1").valueAsString.substr(-5);

Votes

Translate

Translate
Community Expert ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

If the first field is called "Text1" you can use the following code as the custom calculation script of the second field:

event.value = this.getField("Text1").valueAsString.substr(-5);

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
New Here ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

LATEST

Thank you! It worked perfectly

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