← Recipe: validate a form and confirm in a modal

6. Understand the boundaries

luastra/ui · luastra/data · controlled input · about 20 minutes
input → state → decode → domain rule → review → commit

Static types, runtime schemas, application rules, and accessible presentation solve different parts of the form.

When to use it

Read this before adding persistence, server submission, or more fields.

  • Luau types check your code; Data.decode validates values received at runtime.
  • Data string limits count UTF-8 bytes, not visible characters.
  • The email pattern is a small UI check, not proof that an address exists or can receive mail.
  • Clear a field error when that field changes, then validate the complete form again on Review.
  • Keep the modal in the tree with open=false so the host can close it and restore focus deterministically.

Complete inventory

View all pages in Recipe: validate a form and confirm in a modal
← Previous: 5. Check and run