浏览代码

example: use onsubmit to showcase entry

Jonathan Kelley 3 年之前
父节点
当前提交
a939df677a
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      examples/form.rs

+ 3 - 1
examples/form.rs

@@ -14,10 +14,12 @@ fn app(cx: Scope) -> Element {
         div {
             h1 { "Form" }
             form {
-                oninput: move |ev| println!("{:?}", ev.values),
+                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" }
             }
         }
     })