Quantum 0.18.0
Added
Forms that know the action's rules (M1, UI-9). A
<ui:form on-submit>takes each field'srequired,minlength,maxlength,min,max, type and anchoredpatternfrom the action'sq:params, and a select's options from itsenum; 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 asNone, 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) andvalues="{row}"opens it as an edit form.projects/tarefasgained an edit page built this way.quantum checkverifies 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/blogdropped 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#resultsafter 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/tarefashas/planilha.
Changed
- A failed action validation checks every field, not only the first; the flash is still the first error.
Fixed
projects/blog:/searchwith no?q=answered 500 ({trim(query.q)}fails when the URL has no parameters).page=on a paginatedq:querywas read as a number when the file was parsed, sopage="{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.