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."
++ 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:
It see
...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:
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".
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.
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.
Copy link to clipboard
Copied
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.