Skip to main content
Participant
June 11, 2024
Answered

Help with auto filling text box from dropdown selection

  • June 11, 2024
  • 2 replies
  • 1183 views

I have created a fillable form with Javascript so the selection from a dropdown box will auto fill a text box with text that can then be edited by the user. There are two of these dropdowns on the page. Dropdown1 autofills text1 and Dropdown2 autofills text2. The problem I am having is when the text in textbox1 is edited, and then the dropdown2 is selected, the edited changes in text1 are deleted. 

 

The fillable form will be used in a doctor's office for charting. When a diagnosis is selected from dropdown1, it will autofill a generic narrative in text1. That text needs slight edits, such as the patient's gender and age. Everything works fine, until the dropdown2 box is selected, then the edited text in text1 reverts back to the original text from the Javascript.

 

How do I make the edits in text1 permanent so they are not deleted when dropdown2 is selected?

 

Hopefully I have explained this problem well enough...    I have attached the document for reference. 

This topic has been closed for replies.
Correct answer PDF Automation Station

Calculations run EVERY time ANY field value changes.  Move your scripts to the validation tab (Run a custom validation script) instead.

2 replies

PDF Automation Station
Community Expert
Community Expert
June 11, 2024

Calculations run EVERY time ANY field value changes.  Move your scripts to the validation tab (Run a custom validation script) instead.

Participant
June 11, 2024

Thank you. I was pulling my hair out!

JR Boulay
Community Expert
Community Expert
June 11, 2024

This is because you're using the Calculation trigger in the dropdowns, which is triggered each time a field in the document loses focus (on blur).

You must use the Custom Key Format instead.

See attachment.

Acrobate du PDF, InDesigner et Photoshopographe
Participant
June 11, 2024

Thank you.