Hi everyone
I created a simple contact form for my nuxt 3 website. The form gets recognized and displayed in the forms dashboard and netlify is “Waiting on those submissions…”. But i don’t get any submissions when i try to submit some demo input. https://cholufraesser.netlify.app/ is my side. The contact form component looks like this:
<template>
<form
name="contact"
id="contact"
method="POST"
data-netlify="true"
data-netlify-honeypot="bot-field"
@submit.prevent="submitForm"
>
<label>
<span>Name</span>
<input type="text" name="name" required />
</label>
<label>
<span>E-Mail</span>
<input type="email" name="email" required />
</label>
<label>
<span>Nachricht</span>
<input type="textarea" name="message" />
</label>
<input type="hidden" name="form-name" value="contact" />
<button type="submit">Submit</button>
</form>
</template>
<script>
export default {
data() {
return {};
},
methods: {
async submitForm(event) {
console.log(event.target.getAttribute('name'));
let formData = new FormData(contact);
let body = new URLSearchParams(formData).toString();
console.log(body);
await fetch('/', {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
// "Accept": "application/json",
},
body,
}).then(response => console.log(response))
.catch(error => console.error(error));
},
},
};
</script>
And this is the static version inside public/contactForm.html:
<form
name="contact"
netlify
netlify-honeypot="bot-field"
hidden
>
<input type="text" name="name" required />
<input type="email" name="email" required />
<textarea name="message"></textarea>
<input type="hidden" name="form-name" value="contact" />
</form>
Does someone see any error?
Thanks for the help
Raphael