How can I deal gracefully with network errors that occur during HTML form submissions? I don’t want the browser to cache the form or the data in any way, but I don’t want the user to lose their data if there’s a network error while submitting the form (e.g. router crashes).
How can I deal gracefully with network errors that occur during HTML form submissions?
Share
If you can convert your form submission to AJAX, you can handle the errors and update the user without them loosing the form data.
If not you can make an AJAX head request before you submit the form. There could be a small window where the router may crash between your AJAX request and form submission.