Subject: Issue with Netlify Form Submission
Dear Netlify Support,
I hope this message finds you well. I am encountering an issue with form submissions on my website hosted with Netlify. Despite setting up the form according to Netlify’s guidelines, form submissions are not being processed.
Details:
Netlify form was not detected so I added the static HTML form in a public folder then it will detect the netlify dashboard
Nothing works for me No submission found
@jimmynarula You’ve not said what you’ve built the site with.
What’s the URL to the site?
Hi Nathan,
Thanks for getting back to me.
My site is based on Nextjs and prismic. The url to test is Contact - Acadian Supply
We have tried so many methods but the netlify is not detecting form and submitting data.
Melvin
June 21, 2024, 3:02pm
4
Hi @jimmynarula ,
Thanks for reaching out!
For forms with Next.js and the Netlify/Next.js runtime version 5, we updated our docs here:
and here:
Learn about Next.js on our platform. Use App Router, automatic fine-grained caching, image optimization, and more with Next.js 13.5+ on Netlify.
We also have a Starter Template with a Netlify form to demonstrate how the form is coded here:
Modern starter based on Next.js 14 (App Router), Tailwind, daisyUI, and Netlify Core Primitives - netlify-templates/next-platform-starter
The relevant parts here:
the .html
file:
and the js/jsx:
'use client';
import { useState } from 'react';
import { Card } from './card';
export function FeedbackForm() {
const [status, setStatus] = useState(null);
const [error, setError] = useState(null);
const handleFormSubmit = async (event) => {
event.preventDefault();
try {
setStatus('pending');
setError(null);
const myForm = event.target;
const formData = new FormData(myForm);
const res = await fetch('/__forms.html', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams(formData).toString()
This file has been truncated. show original
If you want to compare your code to that of the template to see if it helps troubleshoot the issue.
@jimmynarula I thought you were probably using Next due to the POST being made to /
and it not working.
The answer is all as provided by @Melvin .
If you didn’t spot the mentions in the documentation before, that’d be because they were only very recently added.
Hi @Melvin ,
Thank you for providing me with the updated documentation and after implementing the latest code the forms started to work normally.