Closed animaux closed 6 months ago
The required
attribute is added to fields that must be filled out. However, browsers will ignore this attribute since the form has the novalidate
attribute set. The reason for using novalidate
is that the built-in browser validation is not easily customizable without JavaScript, and we have extensive custom server-side validation checks in place.
In my opinion, this can lead to a poor user experience as form would display two different types of error messages: one from the browser's native validation and another from the server-side validation.
The Email field serves as a good example to illustrate the differences between browser and server-side validation:
Validation Check | Browser | Server |
---|---|---|
Field is required | ✅ | ✅ |
Value is a valid email format | ✅ | ✅ |
Email domain actually exists | ❌ | ✅ |
Email domain is not a throwaway/spam email | ❌ | ✅ |
As you can see, the browser validation stops way early. This pattern is similar for all other form fields.
I fixed the bug you mentioned and it will be included in the upcoming release in the following days.
Thanks for elaborating on the required-attribute, sounds very reasonable!
When trying to submit a form that does not validate, the page gets reloaded showing an error message. If I have selected an option from a select-field before submitting, my choice gets lost and I have to select the desired option again.
The expected result would be for the option to be remembered and kept until the form is successfully submitted.
As a sidenote: is there a special reason why the required-attribute is not inserted in required fields? This would add an extra-validation layer before submission and is supported by virtually all modern browsers.