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

Drop down export value to text field for Mileage

New Here ,
May 29, 2024 May 29, 2024

Copy link to clipboard

Copied

I have a a mileage pdf that I want to turn into a form (attached for reference). It already includes a table for specific locations and the actual mileage between those locations. I've determined that creating a drop down list for the Beginning Site and Ending Site would be best however, do I make them two separate drop down fields or one combined drop down field?  If I make it one combined drop down (named DropDown1.0) then I can enter an Export Value in the Properties Options based on the provided table. What I can't figure out next is how to get that Export Value to display in a text field named MilesRow1. Do I make a custom calculation script within the drop down field or the text field? What does the script need to be?

 

I have spent days reading all the existing community answers to this question but am not understanding what I need to do for my particular situation.  Any guidance would be much appreciated. 

TOPICS
JavaScript , PDF , PDF forms

Views

391

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

correct answers 1 Correct answer

Community Expert , May 29, 2024 May 29, 2024

To show export value from dropdown in text field, you can use custom calculation script in text field like this:

event.value = this.getField("DropDown1.0").value;

 

You could also use two dropdown fields, and then with a script you can check both dropdown values and set mileage depending on two dropdown values, it's a little more complex script but not too hard.

Votes

Translate

Translate
Community Expert ,
May 29, 2024 May 29, 2024

Copy link to clipboard

Copied

To show export value from dropdown in text field, you can use custom calculation script in text field like this:

event.value = this.getField("DropDown1.0").value;

 

You could also use two dropdown fields, and then with a script you can check both dropdown values and set mileage depending on two dropdown values, it's a little more complex script but not too hard.

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 ,
May 29, 2024 May 29, 2024

Copy link to clipboard

Copied

I tried that based on another community thread and the MilesRow1 text field doesn't do anything. Should I have the "Commit selected value immediately" checked on the drop down field for the script to work?

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 ,
May 29, 2024 May 29, 2024

Copy link to clipboard

Copied

Yep, that helped and also making sure the name of the field matched exactly (case sensitive). I am so so happy, thank you for your help. I did go with using one drop down field to keep it simple.

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 ,
May 29, 2024 May 29, 2024

Copy link to clipboard

Copied

One last thing related to this document. Now that I have my drop downs configured and each MileRow field displaying the correct mileage, I have another text field that is using the "Value is the sum +" operation in the Properties Calculate tab to get Total Miles. For some reason, if I change a drop down option, the total miles field shows mileage from the previously selected drop downs Export Value. I can't figure out why it's doing that.

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 ,
May 31, 2024 May 31, 2024

Copy link to clipboard

Copied

LATEST

If you have delay in calculation, check field calculation order.

Select 'Prepare form' tool then click on 'More' and 'Set field calculation order' make sure fields that calculate first are on top.

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 ,
May 30, 2024 May 30, 2024

Copy link to clipboard

Copied

Update: Even thought using one drop down for both the beginning and ending site would be easier, it creates too many options in the drop down. If I did two separate drop downs would I still use the Export Value field? What would the script need to say?

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