Forms: ShowIf reads server facts the handler passes to render and parse, not a hidden field that round-trips #142

Open
opened 2026-09-27 01:55:13 +00:00 by cgalo5758 · 0 comments
Owner

Today a field whose presence depends on something only the server knows is wired through a hidden field. The handler sets the fact into Values, the render decides ShowIf from it and writes it into a hidden input, and the parse reads it back from the submission to know which fields were on the page. Two forms use this: the site create form (customDomainsEnabled, whether the workspace may use its own domains) and the entitlement-set rule form (the chosen resource key's kind).

The round trip is fragile. On a freshly opened form the render left every value empty, including the hidden marker, while ShowIf had already been decided from the bound value. The create form showed "Use a domain I own", submitted the marker empty, and the parse dropped the ticked box and demanded a hosted domain. A render patch now writes hidden values in an unbound render, with a regression test from render to submission to parse, but the mechanism stays subtle.

Done when:

  • forms.Render and the parse take the same handler-supplied server facts, never read from the request, and ShowIf reads those.
  • The site create form and the entitlement-set rule form pass their facts that way, and their hidden marker fields are gone.
  • A submission cannot change which fields the parse expects.
  • The ShowIf doc and the forms spec describe the new trust model.
Today a field whose presence depends on something only the server knows is wired through a hidden field. The handler sets the fact into `Values`, the render decides `ShowIf` from it and writes it into a hidden input, and the parse reads it back from the submission to know which fields were on the page. Two forms use this: the site create form (`customDomainsEnabled`, whether the workspace may use its own domains) and the entitlement-set rule form (the chosen resource key's kind). The round trip is fragile. On a freshly opened form the render left every value empty, including the hidden marker, while `ShowIf` had already been decided from the bound value. The create form showed "Use a domain I own", submitted the marker empty, and the parse dropped the ticked box and demanded a hosted domain. A render patch now writes hidden values in an unbound render, with a regression test from render to submission to parse, but the mechanism stays subtle. Done when: - `forms.Render` and the parse take the same handler-supplied server facts, never read from the request, and `ShowIf` reads those. - The site create form and the entitlement-set rule form pass their facts that way, and their hidden marker fields are gone. - A submission cannot change which fields the parse expects. - The ShowIf doc and the forms spec describe the new trust model.
cgalo5758 added the
kind
debt
area/operator-ui
priority
medium
labels 2026-09-27 01:55:13 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#142