However, we also depend on the form and fields state in order to provide feedback to the user.
For example, we don’t want to show the “required” errors if the user didn’t interact with the form yet.
These allow us to easily have valid/invalid fields changing its appearance, helping the user identify the errors and correct them right away.
By default, the browser does not apply a style to these pseudo-classes, so we can define our own.
” Server-side checking entails the user submitting the form to the server, such as ASP, C# or PHP, then the server code checks and returns an error if it finds one. Client-side validation usually means: Java Script intercepting the form before it’s submitted to check for errors, possibly using regex.
Also, developing on the top of someone else’s solution can easily turn into a painful job.We will explain that in detail in the next section.Each input field stores all possible error messages in data attributes.On this approach, we took advantage of the constraint validation API to perform validations.This allows us to know if a particular field is valid or invalid at a given time, and makes it possible to give the user feedback right away.