Copy link to clipboard
Copied
Hi
Please, can anyone help me to solve this function?
I have a drop down menu "A" where I can select 4 options:
1) empty 2) purchase 3) purchase + construction 4) purchase + renovation.
When in the "A" drop-down menu I select "purchase + construction", or select "purchase + renovation" I want two fields to be shown. The field named "B" and the field named "C".
In all other cases I want the "B" and "C" fields to remain hidden.
I tried this formula:
if (event.value == "PURCHASE + BUILD") {this.getField ("B"). display = display.visible;}
if (event.value! = "PURCHASE + BUILD") {this.getField ("B"). display = display.hidden;}
if (event.value == "PURCHASE + BUILD") {this.getField ("C"). display = display.visible;}
if (event.value! = "PURCHASE + BUILD") {this.getField ("C"). display = display.hidden;}
if (event.value == "PURCHASE + RENOVATION") {this.getField ("B"). display = display.visible;}
if (event.value! = "PURCHASE + RENOVATION") {this.getField ("B"). display = display.hidden;}
if (event.value == "PURCHASE + RENOVATION") {this.getField ("C"). display = display.visible;}
if (event.value! = "PURCHASE + RENOVATION") {this.getField ("C"). display = display.hidden;}
The function only works when I select "PURCHASE + RENOVATION". When I select the "PURCHASE + BUILD" option, nothing goes.
Is there anyone who can please help me to make this function work?
Copy link to clipboard
Copied
Use this as validation script:
if(event.value == "PURCHASE + BUILD" || event.value == "PURCHASE + RENOVATION"){
this.getField("B").display = display.visible;
this.getField("C").display = display.visible;}
else{
this.getField("B").display = display.hidden;
this.getField("C").display = display.hidden;}
In dropdown field properties->options tab, tick 'commit selected value immediately'.
Copy link to clipboard
Copied
If you used space in dropdown to set 'empty' item, it is still a character so use " " not "".
Copy link to clipboard
Copied
I changed the function like this, but the result doesn't change:
if (event.value == "PURCHASE + BUILD") {this.getField ("RENOVATION COST"). display = display.visible; this.getField ("RENOVATION COST_1"). display = display.visible} else {this. getField ("RENOVATION COST"). display = display.hidden; this.getField ("RENOVATION COST_1"). display = display.hidden;}
if (event.value == "PURCHASE + RENOVATION") {this.getField ("RENOVATION COST"). display = display.visible; this.getField ("RENOVATION COST_1"). display = display.visible} else {this. getField ("RENOVATION COST"). display = display.hidden; this.getField ("RENOVATION COST_1"). display = display.hidden;}
Copy link to clipboard
Copied
that's how it works:
if (event.value == "PURCHASE + CONSTRUCTION" || event.value == "PURCHASE + RENOVATION") {this.getField ("RENOVATION COST"). display = display.visible; this.getField ("RENOVATION COST_1" ) .display = display.visible} else {this.getField ("RENOVATION COST"). display = display.hidden; this.getField ("RENOVATION COST_1"). display = display.hidden;}
Copy link to clipboard
Copied
Use this as validation script:
if(event.value == "PURCHASE + BUILD" || event.value == "PURCHASE + RENOVATION"){
this.getField("B").display = display.visible;
this.getField("C").display = display.visible;}
else{
this.getField("B").display = display.hidden;
this.getField("C").display = display.hidden;}
In dropdown field properties->options tab, tick 'commit selected value immediately'.
Copy link to clipboard
Copied
Thank you very much
Copy link to clipboard
Copied
hi
always from the "A" pull-down menu, if it is empty I want the "PRICE" and "PRICE_1" fields to be hidden.
If, on the other hand, I select any item in the "To" field, the fields must be visible.
I tried this feature, but it doesn't work
if (event.value! = "") {this.getField ("PRICE"). display = display.visible; this.getField ("PRICE_1"). display = display.visible;} else {this.getField ("PRICE"). display = display.hidden; this.getField ("PRICE_1"). display = display.hidden;}
Could you please tell me where I'm wrong?
Copy link to clipboard
Copied
If you used space in dropdown to set 'empty' item, it is still a character so use " " not "".
Copy link to clipboard
Copied
OK I fixed the function. Now works. Thank you very much

