That's the value when it's ticked. When it's not ticked the value is Off, resulting in NaN (Not a Number).
The solution is either to use some other kind of field, or to adjust the code, as I've described above.
Ok, so I replaced the field name with a number value in the script and it all works great. THANK YOU!!!
Now the last part needed for this form is to incorporate 2 late fees on the last section - if after 9/21/2017 the late fee is 25% and if after 10/21/2017 the late fee is 50%. I am not sure how to add the second late fee to the script you gave me.
This is my attempt, it's working but not calculating the 1.5 correctly, it's multiplying 1.5 by the result of the first late fee (125) resulting in a total of 187.50 and it should be 150...how can I fix this?
var sub = 100 * Number(this.getField("numEthernet").value); // Replace with actual field names
var s = this.getField("Date").valueAsString; // Replace with actual field name
var t = this.getField("Date").valueAsString;
if (s!="") {
var d = util.scand("mm/dd/yyyy", s);
var cutOffDate = util.scand("mm/dd/yyyy", "9/21/2017");
if (d.getTime()>=cutOffDate.getTime())
sub *= 1.25;
}
if (t!="") {
var d = util.scand("mm/dd/yyyy", t);
var cutOffDate1 = util.scand("mm/dd/yyyy", "10/21/2017");
if (d.getTime()>=cutOffDate1.getTime()){
sub *= 1.5;
}
}
event.value = sub;
I tried again and figured it out, this is what I used and it works great!
var sub = 100 * Number(this.getField("numEthernet").value); // Replace with actual field names
var sub1 = 100 * Number(this.getField("numEthernet").value);
var s = this.getField("Date").valueAsString; // Replace with actual field name
var t = this.getField("Date").valueAsString;
if (s!="") {
var d = util.scand("mm/dd/yyyy", s);
var cutOffDate = util.scand("mm/dd/yyyy", "9/21/2017");
if (d.getTime()>=cutOffDate.getTime())
sub *= 1.25;
}
if (t!="") {
var d = util.scand("mm/dd/yyyy", t);
var cutOffDate1 = util.scand("mm/dd/yyyy", "10/21/2017");
if (d.getTime()>=cutOffDate1.getTime()){
sub1 *= 1.5;
}
}
event.value = sub1;
THANK YOU SO MUCH FOR ALL YOUR HELP AND QUICK REPLIES!!!!!