Skip to main content
Participant
May 21, 2024
Answered

Being able to type into auto populating fields

  • May 21, 2024
  • 2 replies
  • 906 views

I added a custom calculation script that auto populates text boxes when an option from a drop down is chosen, but I also need to be able to type in those text fields as well. I have the ability, but it's not saving my typed text, it just shows the auto populated information.

This topic has been closed for replies.
Correct answer Nesa Nurani

In dropdown field, under 'Options' tab, check 'Commit selected value immediately'.

In your script change this:

var dropdownValue = this.getField("Dropdown1").value;

switch (dropdownValue) {

to this:

switch (event.value) {

2 replies

Nesa Nurani
Community Expert
Community Expert
May 22, 2024

To populate text field from dropdown choices, put the script in dropdown field under 'Validate' tab, this will allow you to populate text field and to enter text manually if needed.

Participant
May 22, 2024

Moving the script into the validate tab, now the script only works if I choose an option from the drop down, click out of the drop down and then click it again.

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
May 22, 2024

In dropdown field, under 'Options' tab, check 'Commit selected value immediately'.

In your script change this:

var dropdownValue = this.getField("Dropdown1").value;

switch (dropdownValue) {

to this:

switch (event.value) {

Thom Parker
Community Expert
Community Expert
May 22, 2024

Under what circumstances should the user be able to enter text? And under what circumstances should they be blocked from entering text?

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
May 22, 2024

They shouldn't be blocked from entering text. I have a form with several text boxes with information about foster parents. Ideally, they would choose a state from the drop down and generic info about each section would enter the text boxes for state specific foster parents. That works so far, but I need to be able to edit that auto populate info because occasionally, while most foster parents would recieve $.30 a mile for transportation, a specific family may be approved for $.35 a mile and that info would need to be changed.

Thom Parker
Community Expert
Community Expert
May 22, 2024

In the dropdown field options, select the "commit immediately" checkbox.  This will fix the issue with clicking out of the field to select a dropdown value. 

Using this setup the user will be able to easily overide the selection. But it also means that getting the selected value back requires reselecting.  If this is not what you want, then you'll need to provided a detailed workflow sequence that covers all cases. 

 

 

 

 

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