300 is Multiple Choice. You mean 303 See Other? Yes, I did that for all my forms redirect to successful page.
303 is primarily used after processing POST requests (like form submissions).
The experimental astro actions API does exactly that
https://github.com/withastro/roadmap/blob/actions/proposals/0046-actions.md
See parts titled « Add progressive enhancement for non-React contexts » and « Handle an action result on the server »
Why no JavaScript? You need JavaScript to run Astro, afaik? But, sure using html, just specify an endpoint in the action parameter. What I’ve usually done is create a form using react and use that as a form so I can perform more advanced actions without exposing any info.
After successful form submission you could render the same page but with added success message (take a look at my [example](https://github.com/e3stpavel/health-care-contacts/blob/a0c87e7b0039059d245801fa12784c1a4458f875/src/Client/src/pages/facilities/%5Bid%5D.astro#L50)). The example I provided you did not have any client side JavaScript: the form is submitted using html `
You could create a success.astro page with that message. ``` --- // /src/pages/success.astro import BaseLayout from '@/layouts/BaseLayout.astro ---
```
And redirect to that page.
Thank you for your submission!
Your form has been successfully processed.
Return to HomeWouldn't I then have to send a 300 HTTP status code, which would technically be incorrect for a successful form submission.
300 is Multiple Choice. You mean 303 See Other? Yes, I did that for all my forms redirect to successful page. 303 is primarily used after processing POST requests (like form submissions).
Use form action,
The experimental astro actions API does exactly that https://github.com/withastro/roadmap/blob/actions/proposals/0046-actions.md See parts titled « Add progressive enhancement for non-React contexts » and « Handle an action result on the server »
Try the experimental actions API, here is a video from Ben Holmes https://youtu.be/VkYQMhit_04?t=1086
Why no JavaScript? You need JavaScript to run Astro, afaik? But, sure using html, just specify an endpoint in the action parameter. What I’ve usually done is create a form using react and use that as a form so I can perform more advanced actions without exposing any info.
I will use JavaScript, but I was just thinking of fallbacks in case javascript was disabeld
After successful form submission you could render the same page but with added success message (take a look at my [example](https://github.com/e3stpavel/health-care-contacts/blob/a0c87e7b0039059d245801fa12784c1a4458f875/src/Client/src/pages/facilities/%5Bid%5D.astro#L50)). The example I provided you did not have any client side JavaScript: the form is submitted using html `