Phase 8 features:
- bind prop: two-way signal <-> input sync
- placeholder, value, style, disabled props
- DS.resource() for reactive async data fetching
- DS.fetchJSON() convenience wrapper
- Props-only element parsing: input { bind: x }
- examples/form.ds: contact form with validation
Fixed: double .value.value bug in bind codegen.
28 lines
557 B
Text
28 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!"
|
|
]
|