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