Skip to content

Quantum 0.18.0 ​

Added ​

  • Forms that know the action's rules (M1, UI-9). A <ui:form on-submit> takes each field's required, minlength, maxlength, min, max, type and anchored pattern from the action's q:params, and a select's options from its enum; the browser checks them before posting. When the server's validation fails, the form comes back with the values sent (never a password) and each error next to its field, in the browser and the console. An attribute on the field wins; rules="off" turns it off. examples/form-rules.q.

  • Forms from a table (M17, UI-10). <q:action table="posts" datasource="db"> takes its params from the table's schema: NOT NULL → required, CHECK … IN → enum, VARCHAR(n) → maxlength, the column type, nullable columns as None, and foreign keys that must name an existing row. A <ui:form> with no fields of its own draws one per column (select for an enum or a foreign key, checkbox for a boolean) and values="{row}" opens it as an edit form. projects/tarefas gained an edit page built this way. quantum check verifies the action's table and columns.

  • Pagination in a tag (M14, UI-11). <ui:pager for="query"> draws previous, the page numbers (with gaps) and next over a paginated query, keeping the other URL parameters, in the browser and the console. projects/blog dropped its hand-made pagination (a count query, LIMIT / OFFSET, URL building) for it.

  • Search as you type (M15, UI-12). <ui:input bind="q" search="results"> refreshes the element #results after each pause in typing, through htmx and the page's own queries, with the search in the URL; a plain GET form underneath, so Enter works without JavaScript; the same in the console. projects/blog's search page uses it.

  • A table that sorts and edits itself (M16, UI-13). <ui:table sort="true"> turns headers into links that order the query in SQL (q:query sortable="true", before pagination); <ui:table edit="table" datasource="db"> makes each shown column an in-cell form posting to a generated action that edits only what the page declares, runs the page's guards, validates with the column's schema rules and updates one row by its key — shown in /_dev. In the console too. projects/tarefas has /planilha.

Changed ​

  • A failed action validation checks every field, not only the first; the flash is still the first error.

Fixed ​

  • projects/blog: /search with no ?q= answered 500 ({trim(query.q)} fails when the URL has no parameters).
  • page= on a paginated q:query was read as a number when the file was parsed, so page="{query.page}" was always page 1: a page could not move through pages at all. It is an expression now, and defaults to the URL's ?page=; an invalid value is page 1 (DB-9).
  • A page that failed while rendering answered 500 without logging anything in production; the error is now in the server log.

← 0.17.0 · All versions · 0.19.0 →

MIT Licensed · Built with VitePress