We help IT Professionals succeed at work.
Get Started

NaN Error in Subtotal Field

parajrn asked
Last Modified: 2013-11-19
Hi everyone,

I'm writing because I've been working to code a fairly simple order form and while I've pretty much gotten everything down, I'm having an issue with getting NaN errors if the discount field on the form does not contain a value.

For example, the form starts out with 0 in the field, and if a user changes the value, the amount is deducted from the total, however if a user erases the 0 or value and leaves the field blank, the subtotal column will display an NaN error.

I've tried sorting through the code and putting in code to treat the discount field as 0 if it is NaN however no matter what I try I haven't been able to solve the issue.

I've attached the code, however it is fairly lengthy mainly due to the fact that the item listings are repeated ten times. The main code to focus on is really at the top near the head (in the script field) and probably the lines after the last item listing where you see Sales Tax and such.

Also, the current version of the form is at:  http://intensivejournal.org/info/buyItems.php

Thanks very much in advance for any assistance.
Watch Question
IT Expert
Top Expert 2009
This problem has been solved!
Unlock 1 Answer and 14 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE