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

Text field value is correct only when cursor is inside text field. (Custom Calculation Script)

New Here ,
Feb 06, 2018 Feb 06, 2018

I use Acrobat Pro DC 18

I have a text field that show the last 3 digits of a select field value (using custom script).

The problem is that it only shows up the 3 digits when the cursor of the mouse is inside the text field. When it's outside, the value is not updated.

If I changed the select box value, the value is correct in the text field.

I fill out the pdf with PDFTK, I added this javascript when opening document so the calculations are triggered :

this.calculateNow();this.calculateNow();

Other fields work just fine. In another field I sum up this value and other fields value and the total is correct. Only the display is not correct for this field.

1. Cursor outside : value is not correct

not clicking.PNG

2. Cursor inside : value is correct

cursor_inside.png

3. Cursor outside : value is not correct

not clicking.PNG

4. Changing value : value is correct :

changing_value.PNG

It works on google chrome pdf viewer. :

chrome.PNG

Why the display value is not the same as its value ?

TOPICS
PDF forms
1.1K
Translate
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 ,
Feb 06, 2018 Feb 06, 2018

Without seeing the file it's very hard to say what's causing this issue.

Can you share the file with us (via Dropbox, Google Drive, Adobe Cloud, etc.)?

Translate
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 ,
Feb 06, 2018 Feb 06, 2018

Thank you for your time.

Here is the document, the calculation is on page 3 :

test.pdf - Google Drive

Translate
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 ,
Feb 06, 2018 Feb 06, 2018

There are multiple errors in your JS code. Check the JS Console.

Translate
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 ,
Feb 06, 2018 Feb 06, 2018

I enabled JS console on startup and enabled "Show console on errors and messages" but I don't get any errors as far as I know :

JS_CONSOLE.PNG

I am not really familiar with debugging JS inside Acrobat. How do I get to see the errors you are talking about ?

Translate
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 ,
Feb 06, 2018 Feb 06, 2018

Change the value of one of the drop-downs...

Translate
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 ,
Feb 06, 2018 Feb 06, 2018

I don't see any error.

Translate
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 ,
Feb 06, 2018 Feb 06, 2018

You have to exit the field after changing the value for it to be committed.

Translate
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 ,
Feb 06, 2018 Feb 06, 2018

No error is showing up when changing the value of dropdown and exiting the field.

Translate
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 ,
Feb 06, 2018 Feb 06, 2018
LATEST

The error messages I'm seeing are for the trim method. This method was introduced in a relatively late version of ECMAScript, so it's possible my version of Acrobat doesn't support it, while your does.

Translate
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