-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support formmethod and formaction in ViewTransitions (#9084)
* Support formmethod and formaction in ViewTransitions * Adding a changeset * Update .changeset/new-pets-fail.md Co-authored-by: Emanuele Stoppa <[email protected]> * Be less clever --------- Co-authored-by: Emanuele Stoppa <[email protected]>
- Loading branch information
Showing
6 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Supports `formmethod` and `formaction` for form overrides |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/astro/e2e/fixtures/view-transitions/src/pages/form-three.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
import Layout from '../components/Layout.astro'; | ||
let formData: FormData | undefined; | ||
if(Astro.request.method === 'POST') { | ||
formData = await Astro.request.formData(); | ||
} | ||
--- | ||
<Layout> | ||
{ | ||
Astro.request.method === 'GET' ? ( | ||
<h2>Contact Form</h2> | ||
<form action="/contact" method="get"> | ||
<input type="hidden" name="name" value="Testing"> | ||
<button id="submit" type="submit" formmethod="post" formaction="/form-three">Submit</button> | ||
</form> | ||
) : ( | ||
<div id="three-result">Got: {formData?.get('name')}</div> | ||
) | ||
} | ||
</Layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.