Skip to main content
Sonny AR
Inspiring
March 13, 2023
Answered

Manually entered Text disappears from the Text Field after digitally sign

  • March 13, 2023
  • 1 reply
  • 1460 views

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."

This topic has been closed for replies.
Correct answer ls_rbls

++ 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".

1 reply

ls_rbls
Community Expert
ls_rblsCommunity ExpertCorrect answer
Community Expert
March 14, 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 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".

try67
Community Expert
Community Expert
March 14, 2023

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.

ls_rbls
Community Expert
Community Expert
March 14, 2023

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.