Improved client-side validation of number fields (fixes #17)