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

Invalid field values being saved after JS code validating interactive form has failed

New Here ,
Apr 06, 2021 Apr 06, 2021

Copy link to clipboard

Copied

I am new to this forum and here is a beginner question from someone trying to add custom Javascript code within an interactive Acrobat form. 

 

Let me try to explain the problem in details. I am using Acrobat 2017 and before saving an interactive form, I have to check whether the sum of two field values is equal to a predefined constant value.

 

I have tried to add Javascript code in the Document Actions section  and associate it to the "Document will be saved" event.

 

If the sum of the two field values is not equal to the desired constant value, I send an alert message, then clear the two field values to force the user entering new valid values.

 

The problem I noticed occurs with the distributed version of the form (typically the type of form that the users will receive). When I test entering two wrong field values, I see the alert message, then the two field values are cleared on screen, as expected. However, if I close the form (without manually saving it) and reopen it, I see the two wrong field values that have been previously saved in the form.

 

Is there a way in the Javascript code to force the form to be saved again after the wrong field values have been cleared?

 

I am concern about those incorrect values being saved and compiled when I will track and collect the interactive forms returned by the users.

TOPICS
PDF forms

Views

348

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 ,
Apr 06, 2021 Apr 06, 2021

Copy link to clipboard

Copied

If you close the form without saving it the values should not be there, unless they are the result of an automatic calculation.

And no, you can't force the file to be saved, unless you install a special script on the computer of each user.

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
New Here ,
Apr 07, 2021 Apr 07, 2021

Copy link to clipboard

Copied

LATEST

Thank you for your quick answer.

 

Actually, I noticed two different behaviors when I tested my code using the same sequence of actions.

 

When I am testing directly from my interactive PDF file in Preview mode, if I enter two wrong values (whose sum is not equal to the desired constant number), then try to save the file, I receive the alert message, the field values are cleared. If I close the PDF file right after without saving a second time, then reopen it, the previous wrong field values are not there anymore (they are really cleared).

 

However, if I try to reproduce EXACTLY that same sequence of actions from the PDF file generated by the Distribute button, then at the last step, the wrong field values will reappear when reopening the PDF file, even though I have seen them cleared previously on the screen when saving before closing the file. 

 

The document action code I added is triggered through the event "The document will be saved."

 

Is it normal that the original PDF form in Preview mode and the distributed PDF form do not beahve the same?

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