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

83

Likes

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

Adobe Community Professional , 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

Likes

Translate

Translate
Adobe Community Professional ,
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

Likes

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
Adobe Community Professional ,
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.

Likes

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

Likes

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