I need to validate textbox entry. It should allow only integers as entityframework fails if user enters characters in this field during binding.
Here is problem:
When user enters 10-d
in this field, parseFloat
returns true
as it takes 10
as number and ignores the rest of values. While IMO it should throw NAN error as input text can not be converted to float.
Please see following samples and you can play with it. http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_parsefloat
The one i am interested it to get NAN for 40 Years input in examples above.
document.write(parseFloat("40 years") + "<br />");
Let me know if i need to do some more verification.