Jump to content

[SOLVED] NaN and Undefined in Javascript


ainoy31

Recommended Posts

Hello-

 

I have a form the calculates the total dimension weight and chargeable weight.  However, these two fields are calculated base on what is entered prior.  So, as I enter my measurements, in the total dimension and chargeable fields I see NaN and undefined pop up.  However, once I finish entering all my measurements, NaN and undefined goes away and displays the correct results.  Does anyone know a fix for this?  Much appreciation.  AM

Link to comment
Share on other sites

Nevermind.  I fixed my issue.  The problem was that I was passing in the var result where I am calculating the total.  First, I needed to check to see is the var result was null or not.  If is was, I need to set my total dimension value to 0.

 

if(result == null)

{

document.getElementById('tot_dim').value = '';

....and so on.

 

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.