Quantcast
Viewing all articles
Browse latest Browse all 152999

Calculate a field if box is checked

Hi,

 

In one of the forms, I am trying to calculate a field value if a box is checked. For aesthetic reason, there are two checkbox field  (Yes/No) with the same field name "CT_Looped" but with different export value - Yes and No. Such that if someone checks Yes, they cant check no and vice versa.

 

I have the following code in the custom script for the field, which is part of a bigger code:

 

 

var DD4 = +getField("PT").value;

var DD3 = +getField("CT").value;

var KW1 = +getField("KWH 1").value;

 

if (this.getField (CT_Looped).value == "Yes") {  //if the field is checked with an export value Yes

                         event.value = (DD3 * DD4* KW1)/2;}

                else{

event.value = DD3 * DD4* KW1;}

 

 

What I am trying to do is if the CT_looped "Yes" checkbox is checked, then field calculates the value as DD3 * DD4* KW1)/2. If its not checked or if the "No" checkbox is checked, then it performs DD3 * DD4* KW1. If neither are checked, then default value of the field is just DD3 * DD4* KW1.

 

When I check/Uncheck the boxes, nothing happens. Can someone help?


Viewing all articles
Browse latest Browse all 152999

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>