Skip to main content
Participating Frequently
Jan 12, 2023 6:10 PM UTC
Answered

Overwriting an auto populated text field from a drop down box.

I have a form that I am building that has a drop box that will auto populate a text field based on what the end user selects..  I also need the user to be able to overwrite that information with their own in the populated text field.  I’ve searched, but cannot find a solution that works for what I need.  When the populated text is overwritten, it defaults back to  the original text.  Any help would be appreciated., thank you.

bebarth
bebarthCorrect answer
Community Expert
Jan 12, 2023 7:38 PM UTC

9 replies

bebarth
Community Expert
bebarthCommunity ExpertCorrect answer
Community Expert
Jan 12, 2023 7:38 PM UTC
Participating Frequently
Jan 12, 2023 8:06 PM UTC

Thank you!  This worked.

Translate
Thom Parker
Community Expert
Community Expert
Jan 12, 2023 6:18 PM UTC

From your description I'm assuming that your autopopulate script is in the calculate event in the text field?  If so then delete it.

Put the script for auto-populating the text field in the "Validation" script for the dropdown. Then data in the text field can be overwritten manually.  

 

 

 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
Jan 30, 2025 10:41 PM UTC

I am working on an issue like OP and your advice helps with being able to add text into the text box, but now the output is delayed and doesn't display until another calculation is run.

 

I tried calculateNow to no effect.

If I move the script back to the Calculate tab it refreshes on time, but goes right back to the OP problem.

Can't set Field Calculation Order for Validation scripts.

Translate
Thom Parker
Community Expert
Community Expert
Jan 31, 2025 12:22 AM UTC

Is the dropdown set to "commit selection immediately"?  This may be the issue.

 

Validation script run on a field when the value of that field is modified. Ordering has no meaning in this context. 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often