Skip to main content
Inspiring
February 19, 2021
Answered

Checkbox conditional equation that returns the sum of 2 fields.

  • February 19, 2021
  • 1 reply
  • 694 views

Hello, 

I am looking to achieve this several times over 'if "checkbox" is checked, value is sum of "fieldA" and "fieldB", else value is "fieldA"'

The formula I put into the Custom calc script is:

var x = this.getField("IntB").value;
var y = this.getField("ProfB").value;
var z = this.getField("Check Box 12").value;
if(z == "Yes")
{

event.value = x + y;
}else{
event.target.value= x;

}

I don't receive an error, but the field remains blank. Any help would be greatly appreciated!

 

This topic has been closed for replies.
Correct answer try67

Change:

event.target.value= x;

To:

event.value= x;

 

And also check the JS Console for error messages after editing the value of one of the fields.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 19, 2021

Change:

event.target.value= x;

To:

event.value= x;

 

And also check the JS Console for error messages after editing the value of one of the fields.

Inspiring
February 27, 2021

Thank you so much for your reply. I didn't recieve a notification until today. I appreciate your timely response!