Copy link to clipboard
Copied
I've spent 2 hours on this and getting nowhere -- this seems pretty simple and I'd appreciate any help!
I have a dropdown "Retired?" with Yes/No options. The properties are set to "Commit selected value immediately."
I have a field called "Liquidity" that should do a calculation if the dropdown is Yes, and do nothing if No.
Here's the code in the field:
var a = Number(this.getField("AP1").valueAsString);
var b = Number(this.getField("AP2").valueAsString);
var c = Number(this.getField("AP3").valueAsString);
var d = Number(this.getField("AP4").valueAsString);
var e = Number(this.getField("AP9").valueAsString);
var x = this.getField("Retired?").value;
if (x = "Yes") {
event.value=(a+b+c+d+e)*.04;
} else {
event.value = "";
}
MY PROBLEM: no matter the dropdown selection, the calculation (a+b+c+d+e)*.04 always appears.
To check the value of the dropdown, I created a test field to display it with this code:
var x = this.getField("Retired?").value;
event.value = x
When I change the dropdown, the field updates with the correct value.
What am I missing to get the dropdown value to be recognized in the calculation?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Use this:
if (x == "Yes") {
Copy link to clipboard
Copied
Thank you SO MUCH! It worked!
I knew it would be something simple but being new to javascript, I had no idea what keywords I would use in a Google search.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more