Copy link to clipboard
Copied
I'm trying to do a 'if this dropdown is xyz AND this other drop down is abc, then text needs to be .....
The variables are both drop downs. The below works ok until the bits in blue are added. Apologies if the below isn't pretty, but please could someone correct where I've gone wrong.
var OffCode = this.getField("O.aff_es_:prefill").value;
var InstChoice = this.getField("Installation choice_es_:prefill").value
if (OffCode=="...") event.value = " ";
else if (OffCode=="FSPE") event.value = "Je ne souhaite ........";
else if (OffCode=="FSFI") event.value = "Je ne souhaite ........";
else if (OffCode=="FSPB") event.value = "Je ne souhaite .........";
else if (OffCode=="FSPB") event.value &&(InstChoice=="Pas d’équipement(s) à installer") event.value = "Je ne souhaite ........";
else event.value = " ";
Copy link to clipboard
Copied
Your syntax is off. The entire IF condition has to be in parentheses and the && operator has to be located between the two conditions. Try this:
else if (OffCode=="FSPB" && InstChoice=="Pas d’équipement(s) à installer") event.value = "Je ne souhaite ........";
However, you also have a logical error, because if OffCode=="FSPB" then the previous condition before that line will be true, and you will never reach it. To solve it you can use nesting, like this:
else if (OffCode=="FSPB") {
if (InstChoice=="Pas d’équipement(s) à installer") event.value = "Je ne souhaite ........";
else event.value = "Je ne souhaite .........";
}
Copy link to clipboard
Copied
Your syntax is off. The entire IF condition has to be in parentheses and the && operator has to be located between the two conditions. Try this:
else if (OffCode=="FSPB" && InstChoice=="Pas d’équipement(s) à installer") event.value = "Je ne souhaite ........";
However, you also have a logical error, because if OffCode=="FSPB" then the previous condition before that line will be true, and you will never reach it. To solve it you can use nesting, like this:
else if (OffCode=="FSPB") {
if (InstChoice=="Pas d’équipement(s) à installer") event.value = "Je ne souhaite ........";
else event.value = "Je ne souhaite .........";
}
Copy link to clipboard
Copied
Thank you as always @try67 - much appreciated