1
0

form.rs 717 B

1234567891011121314151617181920212223242526
  1. //! Forms
  2. //!
  3. //! Dioxus forms deviate slightly from html, automatically returning all named inputs
  4. //! in the "values" field
  5. use dioxus::prelude::*;
  6. fn main() {
  7. dioxus::desktop::launch(app);
  8. }
  9. fn app(cx: Scope) -> Element {
  10. cx.render(rsx! {
  11. div {
  12. h1 { "Form" }
  13. form {
  14. onsubmit: move |ev| println!("Submitted {:?}", ev.values),
  15. oninput: move |ev| println!("Input {:?}", ev.values),
  16. input { r#type: "text", name: "username" }
  17. input { r#type: "text", name: "full-name" }
  18. input { r#type: "password", name: "password" }
  19. button { "Submit the form" }
  20. }
  21. }
  22. })
  23. }