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:

Hello!

I am having the same issue. The URL in the form is correct (and rendering properly in the HTML) but every time the form is submitted it opens a 404 page (and if you reload the page, it works correctly.

<form class="newsletter__form" name="formNewsletter" method="POST" action="/thank-you"><label for="email" class="newsletter__label">Your email:</label> <input id="email" type="text" class="newsletter__input"> <input type="hidden" name="form-name" value="newsletter"> <button type="submit" class="newsletter__button">Subscribe</button></form>

here is the URL danielsouza.org

Strangely enough, I have another form in the same URL and it works fine.

Hey there @esperanca, I see that is thread has already been resolved. Have you tried following the steps the OP posted that fixed their issue?

If you have and it’s still not working let me me know.

Kyle.

1 Like

Hey Kyles,
Unfortunately, still not working.

Hi @esperanca,

The formNewsletter form doesn’t have an input with the name attribute. Not sure if it’s the only cause, but it’s worth a shot.

2 Likes