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

Part of a field

Community Beginner ,
Jan 17, 2019 Jan 17, 2019

Copy link to clipboard

Copied

What I am trying to do is use part of a field that is filled in by a user to fill in another field.  The two examples I am looking at working with are social security numbers and dates.

I have one field that the user inputs the full social security number into.  On other pages, I only need the last four digits of the number.  Is there a way that this can be done?

My second one is a date that is inputted by the user in a YYYYMMDD format.  Some of the pages need each digit added to a single charter block and some of them need a date that takes up two lines, year on top and month date below.  Is there a way either of those can be done?

My experience with Java is very limited so I would prefer to be pointed in the direction so I can learn the info over just being given the answer if possible.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

314

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 , Jan 17, 2019 Jan 17, 2019

What you need is a regular expression. Regular expressions are a very popular tool for parsing strings.

Here's an article on the topic:

https://acrobatusers.com/tutorials/text-matching-regular-expressions

But, the string parsing you've mentioned are pretty simple. You could also use simpler sting manipulation operations.

Here's on article on that topic:

https://acrobatusers.com/tutorials/splitting-and-rebuilding-strings

Votes

Translate

Translate
Community Expert ,
Jan 17, 2019 Jan 17, 2019

Copy link to clipboard

Copied

What you need is a regular expression. Regular expressions are a very popular tool for parsing strings.

Here's an article on the topic:

https://acrobatusers.com/tutorials/text-matching-regular-expressions

But, the string parsing you've mentioned are pretty simple. You could also use simpler sting manipulation operations.

Here's on article on that topic:

https://acrobatusers.com/tutorials/splitting-and-rebuilding-strings

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
Community Expert ,
Jan 17, 2019 Jan 17, 2019

Copy link to clipboard

Copied

It's also very important to know that what you're using is called JavaScript, not Java. Similar names, but very different languages.

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
Community Beginner ,
Jan 17, 2019 Jan 17, 2019

Copy link to clipboard

Copied

LATEST

try67  wrote

It's also very important to know that what you're using is called JavaScript, not Java. Similar names, but very different languages.

  Thanks for that, that will teach me not to proof read before I hit submit

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