My form works but i cannot get the default success-page to show

Hello,
i cannot get a default success message to work. I have read the blogpost that usually gets shared for this kinda problem and several guides but still no luck. i was a little confused as to where to add the action=“thank-you”, or action=“/thank-you” still not sure which way is correct so i tried both ways with no luck. Have added it to my index.html and also to the react code. I don’t know what to try anymore and would be very greatful for some help.
The form works fine and i get emails with the content of messages.

My page is at https://adrian-loosli.netlify.app/
It’s a simple portfolio made with React.

The forms name is “contact”, in the code and also in the netlify dashboard.

I’m a beginner and i’m sure i made some mistakes and also used some code i barely understand :slight_smile:

There are some errors in the console relating to a manifest.json file i don’t understand when i refresh the page.

Thank you.

I think the issue is a little deeper here. Try refreshing the page when you are on /contactMe… see how it throws a 404? I think this is related to react + redirects.

Make sure you have this in the netlify.toml at the root of your site:

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200
  force = false

Am I right in saying you are using create-react-app? If so, the way it works is by mocking pages not actually creating them. So if you go to the “page” /contactMe, it throws not found because that page doesn’t actually exist on the server

The config above tells the server to not actually change page when a link is clicked… this means react can mock a page inside the index.html

Hope this helps :slight_smile:

2 Likes

tbh Create-react-app is very outdated today… this issue being one of the reasons why it’s just not practical anymore. There are some really good beginner Next.js/Gatsby tutorials out there if you want to pursue react :netliheart:

2 Likes

Thanks alot, too tired now but i give this a go tomorrow morning. Yeah i am excited to learn next.js soon, am just doing an online bootcamp atm and thats what were told to use

I have added the file to root directory, run npm run build again and updated the site but problem still persists…same console,log 404 error and no success page on form submit.

Not sure if this is something you’ve recently tried, but you’re using JavaScript based submission:

So you won’t see a thank you page, you’d have to manually show a modal or a notification saying message has been submitted.

1 Like

yeah that was one of many attempts , can you give me a pointer what i need to do to get the success page, i can probably figure it out if i know what to google for. I found some syntax errors and at least the console is now free of those pesky error logs .
Thank you for your help

Oh yes, of course. That should be removed.

1 Like

but also get rid of the javascript based submission, correct?