hypra

FORM-001: field has no name or type

Error: the page doesn't build until this is fixed.

A field's name is the key its value is sent under. Its type, like Email or Int(1..5), makes the right input, checks the value in the browser and on the server, and describes the field to AI agents.

Fails

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  form("/newsletter", name: "newsletter") {
    field(type: Email, label: "Email")
    field("size", label: "Shoe size")
    button "Subscribe"
  }
}
error[FORM-001]: `field` needs `name`
 --> page.hypra:4:5
  |
4 |     field(type: Email, label: "Email")
  |     ^^^^^
  = help: field("email", type: Email, label: "Email")
  = docs: https://hypralang.dev/rules/form-001/

error[FORM-001]: `field` needs `type`
 --> page.hypra:5:5
  |
5 |     field("size", label: "Shoe size")
  |     ^^^^^
  = help: add type: Email, Int(1..5), Text(max: 2000), ...
  = docs: https://hypralang.dev/rules/form-001/

2 errors, 0 warnings

Fixed

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  form("/newsletter", name: "newsletter") {
    field("email", type: Email, label: "Email")
    field("size", type: Int(36..48), label: "Shoe size")
    button "Subscribe"
  }
}