Add client side form validation
Opened this issue · 1 comments
AlstonLin commented
More efficient for the server and better UX. Use the default MDL error UI to show errors. See SelectField for an example of this.
First, build a custom class called FieldValidationError
.
This should be how it works
- The field should handle checking of itself, with props giving the abilities for their users to customize constraints
- If there is an error, the widget should update it's own UI and throw a
FieldValidationError
when getting the value - The users of them form should catch these
FieldValidationError
and simply return if it caught, stopping any further action.
AlstonLin commented
Here's a problem with this approach - since it will throw an error, this will only allow a single field to be validated and update the UI. If there's multiple errors, then only the first one will be shown.
We should figure out a different way to approach this