Forum Discussion
SimonPerkins
13 years agoCommunity Member
Can I prevent "NaN" from appearing in numerical entry?
Is there a way to do this? Am using conditions to handle which numbers ARE allowed and to display an error if invalid numbers are entered. But can't get it to stop letters etc from being entered/...
KevinMcGrath
2 years agoCommunity Member
Found this old thread when trying to solve the same issue in JavaScript. Thought I'd post here in case anyone else needs this solution:
a = a || 0
adding || 0 tell JS that if there's errors on the left side (e.g. NaN) then return a value of 0.