2. Using the HTML5 Form Validation API

We only use two methods of the HTML5 form validation API for validating constraints in the HTML-forms-based user interface of our app. The first of them, setCustomValidity, allows to mark a form input field as either valid or invalid by assigning either an empty string or a non-empty message string to it. The second method, checkValidity, is invoked on a form and tests, if all input fields are marked as valid.

Notice that in our general approach there is no need to use the new HTML5 attributes for validation, such as required, since we do all validations with the help of setCustomValidity and our property check functions, as we explain below.