29 lines
557 B
Text
29 lines
557 B
Text
|
|
-- DreamStack Form Example
|
||
|
|
-- Two-way binding, validation, and reactive form state
|
||
|
|
|
||
|
|
let name = ""
|
||
|
|
let email = ""
|
||
|
|
let message = ""
|
||
|
|
let submitted = false
|
||
|
|
let char_count = 0
|
||
|
|
|
||
|
|
view main = column [
|
||
|
|
text "Contact Form"
|
||
|
|
|
||
|
|
text "Name"
|
||
|
|
input { bind: name, placeholder: "Your name" }
|
||
|
|
|
||
|
|
text "Email"
|
||
|
|
input { bind: email, placeholder: "you@example.com" }
|
||
|
|
|
||
|
|
text "Message"
|
||
|
|
input { bind: message, placeholder: "Type your message..." }
|
||
|
|
|
||
|
|
text char_count
|
||
|
|
|
||
|
|
button "Submit" { click: submitted = true }
|
||
|
|
|
||
|
|
when submitted ->
|
||
|
|
text "Thanks for your message!"
|
||
|
|
]
|