I would like to create a custom success page for my react app. I currently get the default success page when I submit a form with the relative path of the custom success page in the url:
I’ve added the
action=/relative-path attribute to both my html and js files but it still doesn’t work.
My end goal is to display the custom success page and have a link that redirects to the ‘About’ page I have created (which I also don’t know how to do).
- Am I missing something?
- To redirect to the ‘About’ page will I have to use
<BrowseRouter>, <Routes>, etc. from react or can I use something simple like a
Thanks in advance
Deployed app: https://cp-retrofolio.netlify.app/
Repo: GitHub - briandgomez/cp-retrofolio at netlify-deployment
To display a custom page, you’d have to add a
onsubmit event handler to the form along with
event.preventDefault(), and then programatically navigate to using: useNavigate v6.15.0 | React Router.
So to clarify @hrishikesh I can use React Router to display the custom success page, redirect to my homepage ANDI don’t need to create a HTML page for the success page?
@hrishikesh So I’m able display my custom success page but the contact form is no longer working. Whenever I try to submit a form it no longer appears on my form dashboard or email.
I’m not sure what exactly happened since I didn’t really changed anything that would affect the contact form from being sent.
Here is the last commit of when the form was working properly: changed path for action attribute · briandgomez/cp-retrofolio@690682f · GitHub
You’re referring to “Submit a HTML form in AJAX” section in the docs, correct?
Oh that’s awesome! I’m glad our AMAZING Sr support engineer @hrishikesh could be of help in solving your issue. Thanks for coming back and sharing this with the community.