Skip to main content

Module render

Module render 

Source
Expand description

Public form renderer.

Turns a schema::Form into the HTML a visitor fills in. The output is the contract form_runtime.js enhances: pages are <fieldset data-rcms-page> blocks the runtime shows one at a time; with JS off all pages are visible and the form still submits + server-validates.

Provenance + per-embed overrides: the form carries a hidden _form (form id), _embed (the embedding block’s uuid), and a cache-safe _csrf field populated from the double-submit cookie by an inline script (the rendered HTML may be page-cached, so no per-user token is baked in). The submit handler reads the Referer for the source page and resolves the embed’s override from that page’s stream by uuid.

Constants§

HONEYPOT_FIELD
Honeypot field name — a hidden input bots tend to fill.

Functions§

render_form_html
Render a whole form to HTML. embed_id is the embedding block’s uuid (empty when previewed standalone). submit_action is the POST target.