Short version of the question
Is there a way to trigger the native browser form validation error feedback with Javascript?
Detailed version of the question
When trying to submit a form that has a required input field that has not been filled by the user, modern browsers handle the validation automatically, and display an error for the input field where an error has been found.
Each browser handles this in an own way, but to get an idea, here is how Edge is doing it today:
I want to achieve the same native validation feedback but without using the submit event.
According to the documentation for HTMLSelectElement.checkValidity(), I am able to know if the form does validate or not.
I could use this true/false information and handle the visual feedback by writing custom code, but I wonder if there is a way to trigger the native browser error feedback, so I can save time.
Did I try something?
Yes, I tried using a common submit button and using prevent default event to do what I like (and it works), but I want to know if there is a straight way to achieve this, something like HTMLSelectElement.displayErrors() would be logic.
UPDATE
In fact, the method does exist, it's called HTMLFormElement.reportValidity()
