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?
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]);
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]);
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.
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.
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?
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]);
Copy link to clipboard
Copied
Thank you so much!