-
-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from DioxusLabs/jk/form-ma
Pass form values as a hashmap on `oninput`/`onsubmit`
- Loading branch information
Showing
5 changed files
with
103 additions
and
11 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,26 @@ | ||
//! Forms | ||
//! | ||
//! Dioxus forms deviate slightly from html, automatically returning all named inputs | ||
//! in the "values" field | ||
use dioxus::prelude::*; | ||
|
||
fn main() { | ||
dioxus::desktop::launch(app); | ||
} | ||
|
||
fn app(cx: Scope) -> Element { | ||
cx.render(rsx! { | ||
div { | ||
h1 { "Form" } | ||
form { | ||
onsubmit: move |ev| println!("Submitted {:?}", ev.values), | ||
oninput: move |ev| println!("Input {:?}", ev.values), | ||
input { r#type: "text", name: "username" } | ||
input { r#type: "text", name: "full-name" } | ||
input { r#type: "password", name: "password" } | ||
button { "Submit the form" } | ||
} | ||
} | ||
}) | ||
} |
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
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