Skip to main content
Known Participant
September 3, 2025
Question

NaN being displayed

  • September 3, 2025
  • 3 replies
  • 716 views

I am trying to get rid of NaN being dsiplayed. 

event.value = this.getField("End Time Day One").value - this.getField("Start Time Day One").value;
if (isNaN(event.value) || event.value == 0) {
event.value = "";
}

var total = this.getField("Total Hours Day One").value;
if (this.getField("Check Box 1").value != "Off") {
event.value = Number("Total Hours Day One") - 1;
} else {
event.value = Number("Total Hours Day One");
}

3 replies

PDF Automation Station
Community Expert
Community Expert
September 4, 2025

Not a good idea to upload a form with a list of people and corresponding PINs.

brantpro1Author
Known Participant
September 4, 2025

Appreciate the advice. I figured this wasa a safe community.

ls_rbls
Community Expert
Community Expert
September 4, 2025

Hi @brantpro1 ,

 

There were a few things with the original work that still wasn't working right.

 

I've attached the form (linked below) with some improvements. 

 

brantpro1Author
Known Participant
September 4, 2025

Hello,

Thank you for the improvements. Where are the calculations and javascript. When I prepare a form and look at the properties, I see no calculations or javascript to excute the function.

ls_rbls
Community Expert
Community Expert
September 5, 2025

My apologies @brantpro1 ,

 

I moved the custom calculation script to the Total Hours Worked Field.

try67
Community Expert
Community Expert
September 3, 2025

To access a field's value you must use getField("...").value, not just specify the field's name... You did it correctly in the first line of code, but not later on. Also, the second part of your code overrides the first one. You should put all the second part inside an "else" clause.

brantpro1Author
Known Participant
September 3, 2025

So I am extremely new at this. I am not sure where I stopped using getField. Can you eloborate?

Thank you

Bernd Alheit
Community Expert
Community Expert
September 3, 2025

Number("Total Hours Day One")