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

If/Then statement with drop down list

New Here ,
Aug 25, 2020 Aug 25, 2020

Hello,

 

I have a table with 5 columns. Column 2 has a drop down list with options "Each", "Feet", and "N/A". I would like how to get column 5 to auto populate depending on the selection from the drop down.

1. If Column 2 = Each, then Column 5 = Column 4*Column 1

2. Else, Column 5 = Column 4

 

I have found similar posts and tried both a custom calculation and validation script but it does not work.

 

Please help.

TOPICS
PDF forms
2.9K
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
1 ACCEPTED SOLUTION
Community Expert ,
Aug 25, 2020 Aug 25, 2020

You can use something like this in each row of column5 "custom calculation script":

if(this.getField("dropdown").value == "Each"){
event.value = this.getField("Col1Row1").value * this.getField("Col4Row1").value;
}

Rename fields for each row, It's basic code but it should get you there with little adaptation.

If you have any question feel free to ask.

View solution in original post

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 ,
Aug 25, 2020 Aug 25, 2020

Sorry, this is on Adobe Acrobat Pro DC creating a form

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
Enthusiast ,
Aug 25, 2020 Aug 25, 2020

Hi, can you pls be more specific, how many rows in each column and when calculate you calculate entire column or row by row? example: when you say Column 5 = Column 4*Column 1 you mean:

col1row1*col4row1 result in col5row1

col1row2*col4row2 result in col5row2

or col1 all rows * col4 all rows result in one field in col5?

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 ,
Aug 25, 2020 Aug 25, 2020
  • Thank you for responding.

    There are multiple rows. I want the form field in row 1 column 5 to auto
    populate based on the other fields in row 1.
    Does that help?
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 ,
Aug 25, 2020 Aug 25, 2020

You can use something like this in each row of column5 "custom calculation script":

if(this.getField("dropdown").value == "Each"){
event.value = this.getField("Col1Row1").value * this.getField("Col4Row1").value;
}

Rename fields for each row, It's basic code but it should get you there with little adaptation.

If you have any question feel free to ask.

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 ,
Aug 26, 2020 Aug 26, 2020

Thank you so much! This worked!

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 Beginner ,
Nov 06, 2024 Nov 06, 2024

I'm trying to change the results of a dropdown field depending on what's selected in another field....

So, in Dropdown1 if I select "Arlon 510GT (or MT)" I want Dropdown2 to select the "Arlon 3450 Gloss" line.


I added this to the Dropdown1 /calculate/custom calculation script but it;s not working.....

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 ,
Nov 06, 2024 Nov 06, 2024
LATEST

If you already have set values in both fields, and you have no export values, use this as 'Validate' script of Dropdown1:
if(event.value == "Arlon 510GT (or MT)")
this.getField("Dropdown2").value = "Arlon 3450 Gloss";

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