DOC: Add note about form prevent_default behavior. (#1343)

* Add note about form prevent_default behavior.

* Make the default behavior clear on forms with attached event handlers.
This commit is contained in:
Vinicius Gobbo Antunes de Oliveira authored and GitHub committed 2023-08-17 07:57:09 -05:00
1 parent bcebaafb5d
commit 8946944d68
2 files changed
+4

No files matched your search

@@ -51,6 +51,8 @@ Any event handlers will still be called.
> Normally, in React or JavaScript, you'd call "preventDefault" on the event in the callback. Dioxus does _not_ currently support this behavior. Note: this means you cannot conditionally prevent default behavior based on the data in the event.
> Note about forms: if an event handler is attached to the `onsubmit` event of a form, default behavior is to **not submit it**, meaning having `prevent_default: "onsubmit"` will submit it in this case.
## Handler Props
Sometimes, you might want to make a component that accepts an event handler. A simple example would be a `FancyButton` component, which accepts an `on_click` handler: