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

Manually entered Text disappears from the Text Field after digitally sign

Community Beginner ,
Mar 13, 2023 Mar 13, 2023

Copy link to clipboard

Copied

I have a dropdown field, and based on the selection made in this field, predefined text will be automatically populated in a textbox. In addition to this predefined text, some additional text needs to be manually entered into the same textbox. Everything works fine up to this point. However, after digitally signing the document, the manually entered additional text disappears from the textbox.

 

Do you have any solutions to handle this problem?

 

Using this script in the text field "Text1".

event.value = this.getField("Dropdown1").value;

Thank you in advance."

TOPICS
Create PDFs , JavaScript , PDF forms

Views

537

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 , Mar 13, 2023 Mar 13, 2023

++ EDITED REPLY,  modified the g "willCommit" line 4 of the script to reflect the string property and not a field value property as addressed by @try67 

 

Hi,

 

If I understood your workflow correctly, the user interacts with the form in the following manner:

 

  • makes a selection in the dropdown menu
  • the dropdown menu value is populated on Text1 field
  • the user manually inputs additional data on Text1
  • the user signs the form and all commited values are saved after the document is signed

 

It see

...

Votes

Translate

Translate
Community Expert ,
Mar 13, 2023 Mar 13, 2023

Copy link to clipboard

Copied

++ EDITED REPLY,  modified the g "willCommit" line 4 of the script to reflect the string property and not a field value property as addressed by @try67 

 

Hi,

 

If I understood your workflow correctly, the user interacts with the form in the following manner:

 

  • makes a selection in the dropdown menu
  • the dropdown menu value is populated on Text1 field
  • the user manually inputs additional data on Text1
  • the user signs the form and all commited values are saved after the document is signed

 

It seems like you are running the script as a Custom Calculation Script on Text1 field.

 

If that were the case, this  current workflow will change the value entered in Text1 back to whatever the script is enforcing.

 

Note  also that, not only the value will change after the document is signed, but it may  also change every time that another field object value is commited as the user interacts with the PDF form before signing it.

 

It will simply continue to revert back to the value instructed by the script.

 

There are many ways that you can work around this with Acrobat JavaScript.

 

For example, a Validation  Script or (like shown in my example below),  a Custom Keystroke script that executes directly from the dropdown menu (instead of Text1 field) may do the trick.

 

 

 

 

var f = event.value;

var g = f;

var textField = this.getField("Text1");

if (event.willCommit && (g !=="")) {

textField.value = g + " ";

}

 

 

 

 

Make sure that in the Dropdown Properties => Options tab, that you tick the checkbox "Commit selected value immediately".

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 ,
Mar 14, 2023 Mar 14, 2023

Copy link to clipboard

Copied

There are some errors in this code, plus some things that don't make sense. Why the "g" variable, if it's just the same as "f"? And in one point you access g.value, but g is a String, not a Field, and has no such property.

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 ,
Mar 14, 2023 Mar 14, 2023

Copy link to clipboard

Copied

With this method, if I don't store don't store the current value in a variable, the value that populates in the text field is the old current value of the dropdown menu.

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 ,
Mar 14, 2023 Mar 14, 2023

Copy link to clipboard

Copied

LATEST

I corrected that observation an updated the script that was marked as correct. It wasn't throwing any errors in the console though, but thank you as usual for keeping an eye.

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