Hi!
I’m trying to migrate from Nuxt 2 to Nuxt 3 and am having problems with the Netlify Forms. The setup is very similar to Nuxt 2 but I keep getting 404’s. I’m sure I’m missing something obvious but I have been stuck on this for way too long and need a helping hand
And if anyone knows how to properly declare formData without using any
, that would be a real treat!
https://aquamarine-biscuit-625484.netlify.app/kontakt/
<form
name="contact-form-3"
method="POST"
data-netlify="true"
>
<input type="hidden" name="form-name" value="contact-form-3" />
[ form fields ]
<button
type="submit"
@click.prevent="submit()"
>
Submit
</button>
</form>
const submit = () => {
const formData: any = new FormData();
Object.keys(values).forEach((key) => {
formData.append(key, values[key]);
});
fetch('/', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams(formData).toString()
})
.then((res) => {
console.log(res);
})
.catch((error) => console.log(error));
};