Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the build forms recipe to use actions instead. #10374

Open
Abdo-reda opened this issue Dec 15, 2024 · 3 comments
Open

Update the build forms recipe to use actions instead. #10374

Abdo-reda opened this issue Dec 15, 2024 · 3 comments
Labels
help wanted Issues looking for someone to run with them! improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)

Comments

@Abdo-reda
Copy link

📚 Subject area/topic

HTML forms, and Actions

📋 Page(s) affected (or suggested, for new content)

https://docs.astro.build/en/recipes/build-forms/

📋 Description of content that is out-of-date or incorrect

This recipe uses standard handling of html. A section should be included to use actions instead because that's the updated way and a more cleaner way of handling forms in astro.

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

@Abdo-reda Abdo-reda added the improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) label Dec 15, 2024
@sarah11918
Copy link
Member

Hi! I think we would welcome an update to have a recipe building forms with Actions!

Since there may be people who, for whatever reason, might prefer not to use actions, perhaps we can update this recipe to show the exact same thing using actions, and also keep the original at the bottom as an alternative. (Also, we need to update the prerequisite for how server-rendering is now handled!)

Maybe something like:

# Build HTML forms in Astro Pages

With a server adapter, Astro pages can both display and handle forms. In this recipe, you’ll use Astro actions to submit form data to the server and check for errors.

<ReadMore>See how to use a standard HTML form without actions to submit data to the server. Your frontmatter script will handle the data on the server, sending no JavaScript to the client.</ReadMore>

Prerequisites
A project with [a server adapter](/en/guides/on-demand-rendering/#server-adapters) installed.

I will add help wanted on this issue for anyone who would like to update the recipe! 🙌

@sarah11918 sarah11918 added the help wanted Issues looking for someone to run with them! label Dec 16, 2024
@Abdo-reda
Copy link
Author

yes I completely agree, including both approaches would be nice.

@sarah11918
Copy link
Member

Quick resolution could be something like what we have on our i18n recipe page, with a tip pointing to a more updated way to do this now with Actions:

In v5.0, Astro added actions which provide several benefits over basic HTML forms including validating your form data and updating your UI based on the form submission, all without any client-side JavaScript zero JS. If you want to use this method for building forms instead, see our actions guide to learn about these features.

Otherwise, a full recipe on this page would still be welcomed so that someone doesn't have to put all the pieces together from the main guide page!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues looking for someone to run with them! improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)
Projects
None yet
Development

No branches or pull requests

2 participants