F01

Error

Forms and bindings

F01 — A bind: to something that cannot be written

bind: writes what the control holds back to what it names: a state, a store's state, or a field of a loop's item. A constant, a derived value, a prop or a value worked out on the spot cannot take it.

What the compiler said

error[F01]: `bind:` on `Input` writes back to what it names, and `name` is a `derived` value --> src/App.wf:5:11 | 5 | Input(bind: name, label: "Name") | ^^^^^^^^^^ = help: Bind a `state` (or a store's state, or a field of a loop's item); show a value with `value:` = docs: https://webfluent.monzeromer.dev/errors/F01

The fix

Broken

wf

page P(path: "/", title: "T", description: "D") { state first = "Ada" derived name = first.toUpperCase() Heading("Name").h1 Input(bind: name, label: "Name") }

Fixed

wf

page P(path: "/", title: "T", description: "D") { state first = "Ada" derived name = first.toUpperCase() Heading(name).h1 Input(bind: first, label: "Name") }

Bind the state the reader edits (bind: first); show a value that is worked out with value:.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

lints cannot lower it: it would ship a broken page.