Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numeric field validation issues #6

Open
StephenCWills opened this issue May 3, 2021 · 2 comments
Open

Numeric field validation issues #6

StephenCWills opened this issue May 3, 2021 · 2 comments
Labels
bug Something isn't working dependencies Pull requests that update a dependency file

Comments

@StephenCWills
Copy link
Member

Numeric fields are validated by forcing numeric conversion as the user types, leading to the following issues (and possibly more).

  • Erasing the value in the field results in 0 instead of a validation error.
  • Entering a decimal point at the beginning or end of a number doesn't work.
  • Entering two decimals points in the middle of a number results in NaN instead of a validation error.
@StephenCWills StephenCWills added the bug Something isn't working label May 3, 2021
@clackner-gpa clackner-gpa added the dependencies Pull requests that update a dependency file label May 5, 2021
@clackner-gpa
Copy link
Member

Currently the value updates as the user types. We can change the behavior of input fields to update and validate Values on loosing focus only. However that would need to be changed in https://github.com/GridProtectionAlliance/gpa-gemstone/tree/master/react-forms

@StephenCWills
Copy link
Member Author

StephenCWills commented May 5, 2021

I think it would be better if the user's input was kept as-is and simply raised validation errors. Imagine if the user accidentally typed the letter 'q' before Tab when they were trying to move to the next field. Would their input change to NaN, forcing them to go back and re-type the whole thing? If the validation always forcefully produces a valid result, then mistakes like that could get easily overlooked.

That said, I know that numeric field validation has implications in some tools when it comes to databinding so this may be unavoidable. If that is the case here, we should definitely change numeric fields to validate on losing focus instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants