Validate data in a function
I have a form with 3 fields. When the user hits the submit button, it calls a function which calculates the 3 fields together. I also have functions to validate the data in each field. Currently the validation checks that the field is filled in and that the numbers aren't too high or too low. I would also like it to check that the values in each field are actual numbers. I tried using isNaN() but that doesn't seem to be working.
Also, when the form is submitted, I want it to run each of the validation functions and then calculate the results ONLY if there were no errors. If tried setting it up as if/else- with each of the validation returning false if there's an error and true if it's all good, then the calculation function checking if each function is true before performing the math but that doesn't seem to be working either. I'd appreciate a little insight here!
Here are a link to the files
http://tiger.towson.edu/~tbaldw2/loa...r/LoanCalc1.js (with the non-working changes)