Understanding data validation
Adding data validation to a form is hardly an option: it’s a required feature to check the user input in terms of accuracy and completeness to improve the overall data quality by validating the data we want – or need – to collect. It’s also very useful in terms of user experience because the error-handling capabilities it comes with will enable our users to understand why the form doesn’t work and what they can do to fix the issues preventing them from submitting their data.
To understand such a concept, let’s take our current CityEditComponent
Reactive Form: it works fine if our users fill out all the required fields; however, there’s no way for them to understand what the required values actually are, or what happens if they forget to fill all of them out... except for a console error message, which is what our source code currently displays whenever our PUT
and POST
requests end up with a back-end...