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

Assign values in a dropdown menu

New Here ,
May 27, 2023 May 27, 2023

I am creating a form.  In the fillable form, I want to create a dropdown field with the choices of adult or child.  For those choices, I want to assign the value $25 or $15 and populate the value to a field "Amount" based on which option was selected (adult or child).  

TOPICS
Create PDFs
768
Translate
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 27, 2023 May 27, 2023

Set values as 'export values' of choices in dropdown.

To set export value go to dropdown field properties, then click on 'Options' tab, where it says 'export value' enter $25 for 'adult' choice and $15 for 'child' choice, now click on 'Calculate' tab and select 'Custom calculation script' and paste this:

this.getField("Amount").value = event.value;

 

Translate
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, 2023 May 29, 2023

I can't paste it for some reason but when I type it in, it doesn't work.

Translate
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, 2023 May 29, 2023

Nesa,

My Amount field is named AmountRow1.  I think that may be the issue.  I am not sure.  Also, I would like to create a field that would give me the total number of adults and children that are registered.

Translate
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 29, 2023 May 29, 2023

Did you type it in correctly?

Try copy/paste this:

this.getField("Amount").value = event.value;

 

EDIT:

In that case, change field name to "AmountRow1".

How many dropdown fields do you have?

Translate
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 31, 2023 May 31, 2023
LATEST

In this section of my registration form, I only have one dropdown menu with the options (adult or child).

 

 

Translate
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