Fix bug when allowDecimals is false

Disallow direct input of "." and "," if allowDecimals is false.
Only "-" and numbers are allowed.