Native js encapsulated form submission verification method

the native checkValidity () method returns a Boolean value. True indicates that the check is passed, and false indicates that the check is not passed. Therefore, the submit form can be encapsulated as the following function.

function submitForm (action) {
var form = document.getElementById ("form");
form.action = action;
if (form.checkValidity ()) {

)
form.submit();

}
}

but this checkValidity () method only validates some of the basic checks provided by the browser api. Now you need to customize some checks (for example, verify that the form A value must be greater than the form B value. And whether a form value in the background of the ajax request is verified repeatedly. How to improve the method to make it a general method.

Aug.18,2021
It is impossible for a native method of

to consider the contents of its superset. You can consider overriding overwrite in form.prototype, or write one yourself.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eadcf5-2184.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eadcf5-2184.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?