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

count character and add text to location

New Here ,
Jun 14, 2019 Jun 14, 2019

Copy link to clipboard

Copied

I am trying to count the number of numbers and add a + symbol to the second to last value in form field

example

user input into field 1000

form format 10+00

user input into field 10000

form format 100+00

user input into field 100000

form format 1000+00

TOPICS
Acrobat SDK and JavaScript

Views

384

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 , Jun 14, 2019 Jun 14, 2019

Here's a simple general purpose script for this

event.value = event.value.replace(/(\d\d)$/,"+$1");

If you want to change the actual value of the field, this script should be placed in the validation or "WillCommit" event script.

If you just want to change how the field is displayed to the user, then it should be placed in the Format Script.

Votes

Translate

Translate
Community Expert ,
Jun 14, 2019 Jun 14, 2019

Copy link to clipboard

Copied

LATEST

Here's a simple general purpose script for this

event.value = event.value.replace(/(\d\d)$/,"+$1");

If you want to change the actual value of the field, this script should be placed in the validation or "WillCommit" event script.

If you just want to change how the field is displayed to the user, then it should be placed in the Format Script.

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

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