simevidas
2021-01-14
Google’s “Payment and address form best practices” article suggests disabling submit buttons once they have been activated by the user. The idea is to prevent repeated form submissions if the user clicks/taps the submit button repeatedly in short succession.
In order to do that, the web page needs to check if the form is currently being submitted:
form.addEventListener('submit', (event) => {
if (/* form submission in progress */) {
event.preventDefault();
}
});
Is there a standard way to do the /* form submission in progress */
check? Is this check even needed, or can this pattern be implemented in a different, better way?