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

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

New Here ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

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.

TOPICS
How to , JavaScript , PDF forms

Views

1.2K

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
1 ACCEPTED SOLUTION
Community Expert ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

Hi,

Did you have a look on this post:

https://community.adobe.com/t5/acrobat-discussions/is-there-a-way-to-allow-end-user-to-overwrite-a-a...

Here is an other example with a drop down box.

@+

 

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 ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

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.  

 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
New Here ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

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.

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

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. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
New Here ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

Yeah, meant to add that the Commit selection was engaged, but no edit function.

I understand ordering has no meaning, just checking off all of the "what if it was X?" things that I could think of with my novice brain.

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

Can you post the form?

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
New Here ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

Page 1.
Dropdowns: Calling, Culture, & Background.
I was testing variants of what could go in Validate vs Calculate, so some of the data is split.

When it's in Validate, if you select a Background, it gives delayed response when Validate but allows for appending text.

When in Calculate, it does not delay updates but doesn't let one change the data (forces it to reset to the output).

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

LATEST

In a validate script the value of the newly selected item is in "event.value". Your scripts are using getField to acquire the field the script is in. This gets the previosly selected value, because the field value doesn't change until after validation is complete. 

 

However, if you really wanted the field object, it is in event.target. So no need to use the getField function. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

Hi,

Did you have a look on this post:

https://community.adobe.com/t5/acrobat-discussions/is-there-a-way-to-allow-end-user-to-overwrite-a-a...

Here is an other example with a drop down box.

@+

 

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
New Here ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

Thank you!  This worked.

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