Auto populate question, can't find anything on forums

Contributor ,
Sep 02, 2018

Copy link to clipboard

Copied

I'm not sure if this is possible, but if it is will be worth the question for me to ask...

I would like to auto populate a backslash at the beginning of a number and a period at the end of a number.  The problem is I don't know what number the user is going to enter on the text field

For example, if the user types 8091000 then \8091000. will appear on another text field.

Thank you!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

If you're flattening the file then it doesn't matter.

You can use this code as the field's custom Format script:

if (event.value) event.value = "\\" + event.value + ".";

Edit: I used two back-slashes on purpose. Do not change it to one...

TOPICS
Acrobat SDK and JavaScript

Views

141

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

Auto populate question, can't find anything on forums

Contributor ,
Sep 02, 2018

Copy link to clipboard

Copied

I'm not sure if this is possible, but if it is will be worth the question for me to ask...

I would like to auto populate a backslash at the beginning of a number and a period at the end of a number.  The problem is I don't know what number the user is going to enter on the text field

For example, if the user types 8091000 then \8091000. will appear on another text field.

Thank you!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

If you're flattening the file then it doesn't matter.

You can use this code as the field's custom Format script:

if (event.value) event.value = "\\" + event.value + ".";

Edit: I used two back-slashes on purpose. Do not change it to one...

TOPICS
Acrobat SDK and JavaScript

Views

142

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
Sep 02, 2018 0
Contributor ,
Sep 02, 2018

Copy link to clipboard

Copied

Also, the number entered could be between a 4 digit to a 9 digit number

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
Reply
Loading...
Sep 02, 2018 0
Most Valuable Participant ,
Sep 02, 2018

Copy link to clipboard

Copied

Do you want to actually change the value, or just the way it is shown on the page?

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
Reply
Loading...
Sep 02, 2018 0
Contributor ,
Sep 02, 2018

Copy link to clipboard

Copied

I'd like to change the value, but maybe just the way it's shown on the page would be easier?

I am selecting the data on the table that I need to export to excel on the PDF after it's flattened with 'copy with formatting'.  I am importing the data from excel into another program which only accepts a number with a backslash and period. 

I could add it after I export the data into excel but it would be easier if it populated in the PDF instead.

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
Reply
Loading...
Sep 02, 2018 0
Most Valuable Participant ,
Sep 02, 2018

Copy link to clipboard

Copied

If you're flattening the file then it doesn't matter.

You can use this code as the field's custom Format script:

if (event.value) event.value = "\\" + event.value + ".";

Edit: I used two back-slashes on purpose. Do not change it to one...

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
Reply
Loading...
Sep 02, 2018 1
Contributor ,
Sep 02, 2018

Copy link to clipboard

Copied

You are the best!!  Thank you so much!!

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
Reply
Loading...
Sep 02, 2018 1