re-org Form docs (#1104)

- added `/concepts/forms`
- added 303 redirect in `POST` form submit code example

previous PR: https://github.com/denoland/fresh/pull/1040

---------

Co-authored-by: Matthew Morek <matthew.morek@gmail.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Co-authored-by: Séverin Dupouy <32488190+severindupouy@users.noreply.github.com>
Co-authored-by: hashrock <hashrock@users.noreply.github.com>
This commit is contained in:
Andy Jiang
2023-04-11 09:56:55 -07:00
committed by GitHub
co-authored by Matthew Morek Luca Casonato Séverin Dupouy hashrock
parent 3c0c576a54
commit ff9bb0f132
3 changed files with 65 additions and 2 deletions
+5 -2
View File
@@ -18,10 +18,10 @@ JavaScript to make them more interactive.
The way forms work in the browser, is that they perform an HTML navigation
action when the user submits the form. In most cases this means that when the
form is submitted, a GET or POST request is sent to the server with the form
form is submitted, a `GET` or `POST` request is sent to the server with the form
data, which then responds with a new page to render.
Fresh can handle both GET and POST requests through the
Fresh can handle both `GET` and `POST` requests through the
[custom handlers][custom-handlers] feature of routes. The handlers can perform
any necessary processing on the form data, and then pass data to the
`ctx.render()` call to render a new page.
@@ -71,6 +71,9 @@ query set as the `q` query parameter in the URL. The `GET` handler will then
filter the names array based on the query, and pass it to the page component for
rendering.
[Learn more about using forms in Fresh][concepts-forms].
<!-- TODO(lucacasonato): link to todo app example when that is built again -->
[custom-handlers]: /docs/getting-started/custom-handlers
[concepts-forms]: /docs/concepts/forms