• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with auto filling text box from dropdown selection

Community Beginner ,
Jun 10, 2024 Jun 10, 2024

Copy link to clipboard

Copied

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. 

TOPICS
How to , JavaScript , PDF forms

Views

447

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
2 ACCEPTED SOLUTIONS
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

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.

View solution in original post

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

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

View solution in original post

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

Thank you. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

LATEST

Thank you. I was pulling my hair out!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines