Home
Support Forums

Netlify form success page showing 404, but displayed when refreshing

I have a recently deployed site here; https://angry-brahmagupta-35cffb.netlify.app/.

The site has a contact page at Contact | Hooper Architecture.

I have added a data-netlify=true and name=contact to the form in my code.

When I see the build output, it appears to discover my form:

9:05:30 PM: Processing form - contact

9:05:31 PM: Detected form fields:

9:05:31 PM: - country

9:05:31 PM: - first_name

9:05:31 PM: - last_name

9:05:30 PM: Started saving pip cache

9:05:31 PM: Finished saving pip cache

9:05:31 PM: Started saving emacs cask dependencies

9:05:31 PM: - company

9:05:31 PM: Finished saving emacs cask dependencies

9:05:31 PM: Started saving maven dependencies

9:05:31 PM: Finished saving maven dependencies

9:05:31 PM: Started saving boot dependencies

9:05:31 PM: - email

9:05:31 PM: Finished saving boot dependencies

9:05:31 PM: Started saving rust rustup cache

9:05:31 PM: Finished saving rust rustup cache

9:05:31 PM: Started saving go dependencies

9:05:31 PM: Finished saving go dependencies

9:05:31 PM: Build script success

9:05:31 PM: - phone_number

9:05:31 PM: - message

I have set an action on the form as action="/thanks". If i go to Contact | Hooper Architecture I can see the page properly.

When I submit the form however, with data entered, I see a 404 page - but the URL has been updated to Contact | Hooper Architecture. If I then refresh the page, I see my thanks page.

Video demo of the issue here; Loom | Free Screen & Video Recording Software

What have I done wrong?

So this is interesting.

I stripped my form all the way back to:

<form name="contact" action="POST" data-netlify="true" netlify-honeypot="country">
// ... rest of the form

And still got a 404.

It appeared as if the form-name hidden input was not being added, and this was confirmed by looking at the rendered markup.

I added a hidden field myself:
<input type="hidden" name="form-name" value="contact" />

Then the form submitted fine by itself, with the Netlify default thanks page.

So I added the custom action action="/thanks" back in and then it was working.

Originally I wanted this to be an AJAX submission, low and behold this was working fine now too.

NFI what was causing issues to begin with, as I had tried the form-name hidden input earlier on, but all is fine and working now.

1 Like

Brilliant! Well done for getting this sorted :grinning: