Copy link to clipboard
Copied
Hi
I have four drop-down menu fields.
In each field I can select multiple options.
When I select "NOT OCCUPIED" or empty "", I want the value 1 to be given, if instead other items in the drop-down menu are selected, I want the value to be zero 0.
I put this function in a field, because I want it to give me the sum of all values
var h1 = this.getField ("PROFESSION-1"). value;
var h2 = this.getField ("PROFESSION-2"). value;
var h3 = this.getField ("PROFESSION-3"). value;
var h4 = this.getField ("PROFESSION-4"). value;
if (h1 == "NOT BUSY" && h1 == "") {var i1 = 0;} else {var i1 = 1;}
if (h2 == "NOT BUSY" && h2 == "") {var i2 = 0;} else {var i2 = 1;}
if (h3 == "NOT BUSY" && h3 == "") {var i3 = 0;} else {var i3 = 1;}
if (h4 == "NOT BUSY" && h4 == "") {var i4 = 0;} else {var i4 = 1;}
event.value = i1 + i2 + i3 + i4;
Unfortunately it doesn't work
Please, can anyone help me?
1. There can't be 2 values at once so instead of '&&'(and) use || (or).
2. Dropdown field doesn't have empty "" value.
Copy link to clipboard
Copied
1. There can't be 2 values at once so instead of '&&'(and) use || (or).
2. Dropdown field doesn't have empty "" value.
Copy link to clipboard
Copied
Thank you very much
Copy link to clipboard
Copied
2. It can have, if the items in it were set using a script. It's true that it can't be done manually, though.