Copy link to clipboard
Copied
I have a form with several dropdowns. I'm trying to display FieldA if certain selections are made in two of the dropdowns. Here is custom calculation code for FieldA that works, but isn't quite what I need:
var c = this.getField("DropdownA").valueAsString;
var b = this.getField("DropdownB").valueAsString;
if ((c == "95" || c == "96" || c == "97") && (b !== "05"))
{
event.target.display = display.visible;
}
else {
event.target.display = display.hidden;
}
That gets me almost where I need to be, except that I need to add an 'OR' condition for var b as well. When I try to update the code with the OR condition like below, the field remains visible all the time:
var c = this.getField("3142CoverMaterial").valueAsString;
var b = this.getField("3142Base").valueAsString;
if ((c == "95" || c == "96" || c == "97") && (b !== "05" || b !== "16"))
{
event.target.display = display.visible;
}
else {
event.target.display = display.hidden;
}
Any single var b condition will work, but as soon as I try to add an 'OR' to that side of the &&, FieldA remains visible if any of var c are true, regardless of var b.
My apologies for the clunkiness of my question, but can anyone shed any light about why this wouldn't work as I have it typed? Please let me know if clarification is needed. Thank you in advance.
Use a 'AND' condition for var b.
if ((c == "95" || c == "96" || c == "97") && (b !== "05" && b !== "16"))
Copy link to clipboard
Copied
Use a 'AND' condition for var b.
if ((c == "95" || c == "96" || c == "97") && (b !== "05" && b !== "16"))
Copy link to clipboard
Copied
So simple! Thank you @Bernd Alheit . This was the change I needed.