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

If/Then statement with drop down list

New Here ,
Aug 25, 2020 Aug 25, 2020

Copy link to clipboard

Copied

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

Views

2.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

correct answers 1 Correct answer

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.

Votes

Translate

Translate
New Here ,
Aug 25, 2020 Aug 25, 2020

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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?

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

Copy link to clipboard

Copied

  • 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?

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

Thank you so much! 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
Community Beginner ,
Nov 06, 2024 Nov 06, 2024

Copy link to clipboard

Copied

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.....

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

Copy link to clipboard

Copied

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";

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