Skip to main content
Inspiring
Feb 19, 2021 6:12 PM UTC
Answered

Checkbox conditional equation that returns the sum of 2 fields.

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 is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Feb 19, 2021 6:49 PM UTC

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.

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Feb 19, 2021 6:49 PM UTC

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.

Translate
Inspiring
Feb 27, 2021 7:07 PM UTC

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

Translate