Forms & validation

Feature origin: Tint

Tint participates in native forms through ElementInternals. Set name to include the field in submission.

<form method="post" action="/notes">
  <label for="notes">Notes</label>
  <tint-editor id="notes" name="body" value="# Draft" required></tint-editor>
  <button type="submit">Save</button>
  <button type="reset">Reset</button>
</form>

Validation and reset

required blocks submission for an empty editable field. Reset restores the default. readonly prevents edits but still submits; disabled omits the field.

Reading the submitted value

const markdown = new FormData(form).get("body");

See the live htmx example for a form that posts to Go.