Copy link to clipboard
Copied
This one has me stumped. I have four checkboxes named A, B, C and D. I also have a text field that is formatted for numbers. Two of the four check boxes will alway be checked. If I check the A checkbox and C checkbox OR the A checkbox and the D checkbox, I want the number 0 to appear in the Numbers text field. If I check the B checkbox and the C checkbox, I want the number 500 to appear in the Numbers text field. If I check the B checkbox and the D checkbox, I want the number 800 to appear in the Numbers text field. Thanks for any help with this.
Copy link to clipboard
Copied
You didn't specify what should happen if C and D are ticked... But at any rate, you can use this code for that:
var a = this.getField("A").valueAsString!="Off";
var b = this.getField("B").valueAsString!="Off";
var c = this.getField("C").valueAsString!="Off";
var d = this.getField("D").valueAsString!="Off";
if ((a && c) || (a && d)) event.value = 0;
else if (b && c) event.value = 500;
else if (b && d) event.value = 800;
else event.value = "";
Copy link to clipboard
Copied
You didn't specify what should happen if C and D are ticked... But at any rate, you can use this code for that:
var a = this.getField("A").valueAsString!="Off";
var b = this.getField("B").valueAsString!="Off";
var c = this.getField("C").valueAsString!="Off";
var d = this.getField("D").valueAsString!="Off";
if ((a && c) || (a && d)) event.value = 0;
else if (b && c) event.value = 500;
else if (b && d) event.value = 800;
else event.value = "";
Copy link to clipboard
Copied
C and D would never both be ticked. I'll give this a try and report back. Thanks!
Copy link to clipboard
Copied
Works perfectly. Thanks!