Skip to content

Commit

Permalink
Submit form event
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeSCahill committed Apr 24, 2023
1 parent f84d267 commit 6844b20
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/partials/form-404.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form data-netlify="true" id="notfound" name="notfoundForm" method="POST" netlify-honeypot="bot-field" onsubmit="handleSubmit(event)">
<form data-netlify="true" id="notfound" name="notfoundForm" method="POST" netlify-honeypot="bot-field">
<input class="hidden" type="hide" name="form-name" value="notfoundForm"
/>
<p class="hidden">
Expand All @@ -17,7 +17,7 @@ var url = document.getElementById('url');
var date = document.getElementById('date');
url.value = window.location.href;
date.value = new Date();
const handleSubmit = function (e) {
form.submit(function (e) {
e.preventDefault();
const formData = new FormData(e.target)
Expand All @@ -27,11 +27,9 @@ const handleSubmit = function (e) {
body: new URLSearchParams(formData).toString(),
}).then(() => {
console.log('Form submission success')
clearFeedbackModal()
})
.catch(error => {
console.error('Form submission error:', error)
})
}
document.getElementById('submit-button').click();
})
</script>

0 comments on commit 6844b20

Please sign in to comment.