Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Dropdown box and Calculations problem

New Here ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

I'm trying to create a dropdown field in prepare form. I want one of the option to just be dashes "-------" when selected as that field is used when another is not and vice versa. When it is to the used I want a second option to display the calucation of another field multiplied by 1.5. I don't know how to do this, however. Could someone more knowledgeable help me?

TOPICS
General troubleshooting, How to, JavaScript

Views

52

Likes

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

Adobe Community Professional , Sep 09, 2021 Sep 09, 2021
You can use this instead: var drop = this.getField("TOTAL"); var drop2 = this.getField("JETTY"); var res = event.value*1.5; var res2 = event.value*3; drop.setItems(["-------",res]); drop2.setItems(["-------",res2]);

Likes

Translate

Translate
Adobe Community Professional ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

In a field where you have calculation use script as validation event and change dropdown field name in script to your actual name:

var drop = this.getField("Dropdown");
var res = event.value*1.5;
drop.setItems(["-------",res]);

Likes

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 ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

So I put this into the validation properties of the 1.5 field labled "TOTAL"? I''m trying to have a field labled "RENT" get multiplied by 1.5 and diplsay is the "TOTAL" field when one of the options is chosen from the "TOTAL" dropdown field is that helps.

Likes

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
Adobe Community Professional ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

If I understand you right, you should put script in "RENT" field as validation.

Script will multiply "RENT" value by 1.5 and then put two choices in "TOTAL" field which is I asume dropdown field, choices will be "------" and "RENT" value multiplied by 1.5, every time value in "RENT" field changes it will adapt choices in "TOTAL" field.

Likes

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 ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

That worked! Thank you so much. I have another question if you don't mind. Is there a way to have the RENT field run 2 calculations and input to multiple dropboxes? Along with the TOTAL field (1.5x) there is a field called "JETTY" that needs options of RENT multipled by 3 and dashes. Is that possible or can the javascript only do one calculation?

Likes

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
Adobe Community Professional ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

You can use this instead:

var drop = this.getField("TOTAL");
var drop2 = this.getField("JETTY");
var res = event.value*1.5;
var res2 = event.value*3;
drop.setItems(["-------",res]);
drop2.setItems(["-------",res2]);

Likes

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 ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

LATEST

Thank you so much!

Likes

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