CKTIS / JavaScript
HTMLFormElement.requestSubmit() — submitting a form with validation
requestSubmit() starts the standard form submission procedure, which can include validation and a submit event. An optional button identifies the submitter and can change submission settings. Unlike submit(), this method does not bypass these mechanisms.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
form.requestSubmit();
form.requestSubmit(submitter);HTMLFormElement.requestSubmit is a form method defined by the HTML Living Standard, not ECMAScript. Calling form.requestSubmit() starts the submission procedure, which can stop before interactive constraint validation. For example, if the form is not connected to the document, the procedure returns without running validation or dispatching a submit event. If the procedure reaches the validation step, it runs validation unless the form's novalidate or the selected button's formnovalidate disables it. Failing validation stops submission, but passing or skipping it does not guarantee that a cancelable submit event will be dispatched. The method returns undefined, not a validation result or a promise.
Passing null as the optional submitter is equivalent to omitting the argument. In either case, the method does not automatically select the first button, and event.submitter is null. Only a non-null submitter must be a submit button associated with this form. The button need not be inside the form because the form attribute can establish that association. An element that is not a submit button causes TypeError, while a submit button associated with another form or no form causes NotFoundError.
The supplied button is available as event.submitter. Its formaction, formenctype, formmethod, formnovalidate, and formtarget can affect submission, and its name/value pair can enter the form data. requestSubmit() does not emit a click event. In contrast, form.submit() bypasses both interactive validation and the submit event; it is not an equivalent replacement. Calling event.preventDefault() in the submit handler stops the default submission.
In the example, the form is connected to the document: an empty required field blocks the first submission attempt, and the second reaches the submit event. This is a browser API; having Node 24 does not establish its availability. The standard's compatibility table lists Chrome 76+, Firefox 75+, and Safari 16+; check typeof HTMLFormElement === 'function' && typeof HTMLFormElement.prototype.requestSubmit === 'function' in the target environment.
Examples
(() => {
const form = document.createElement('form');
const input = document.createElement('input');
input.name = 'topic';
input.required = true;
const button = document.createElement('button');
button.type = 'submit';
button.name = 'action';
button.value = 'save';
form.append(input, button);
document.body.append(form);
let submissions = 0;
input.addEventListener('invalid', event => {
event.preventDefault();
console.log('invalid');
});
form.addEventListener('submit', event => {
event.preventDefault();
submissions++;
console.log('submit: ' + event.submitter.value);
});
try {
form.requestSubmit(button);
input.value = 'JavaScript';
form.requestSubmit(button);
console.log('submissions: ' + submissions);
} finally {
form.remove();
}
})();Result
invalid submit: save submissions: 1
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.