Core Concepts
Forms combines declarative blueprints with compiled per-form submission schemas and atomic concurrency tables.
Submission & Delivery Pipeline
Section titled “Submission & Delivery Pipeline”flowchart LR
Source["YAML Blueprints or Visual Builder"] --> Repo["FormRepository (forms-definitions)"]
Repo --> Front["FrontendForm (/embed, /ajax, FieldtypeForms)"]
Front --> Spam["SpamGuard (Honeypot, SignedState, CAPTCHA, Rate Limit)"]
Spam --> Valid["FormValidator + ConditionalEvaluator + CalculationEvaluator"]
Valid --> Cipher["FieldValueCipher (enc:forms:v1:)"]
Cipher --> Store["Compiled Blueprint (forms-sub-{slug})"]
Store --> Deliver["SubmissionPipeline (Mail, Signed Webhook, PDF, Element Mapping)"]
Dual Storage: File Blueprints + Entries Definitions
Section titled “Dual Storage: File Blueprints + Entries Definitions”FormRepository discovers form definitions from two sources simultaneously:
- Database-Backed (
forms-definitions): Created and edited in the Visual Form Builder under Setup -> Forms or saved programmatically via$forms->saveForm($slug, $spec). - File-Backed (
site/forms/*.{yaml,yml,php}): Version-controlled YAML or PHP specifications stored insite/forms/(plus any extra directories registered with$forms->addFormsPath($path)). File-backed forms receive internal lock anchors (forms-locks) so transaction locks work identically to database forms.
Compiled Submission Blueprints (forms-sub-{slug})
Section titled “Compiled Submission Blueprints (forms-sub-{slug})”For every form with save_submissions: true, SubmissionBlueprintCompiler dynamically compiles a typed Entries blueprint named forms-sub-{slug}:
- Maps canonical
column_span(1..12) and field types directly into Table and KanbanDataViewportcolumns. - Seeds 4 built-in multilingual workflow labels in
forms-statuses(New,In Progress,Resolved,Spam) viaensureBuiltInStatusesSeeded(). - Supports per-form retention pruning (
PruneFormSubmissionsTask) and cascade deletion when a form definition is removed.
Three Managed SQL Tables (FormsTables)
Section titled “Three Managed SQL Tables (FormsTables)”High-concurrency counters and replay guards live in three atomic managed SQL tables owned by FormsTables::OWNER:
forms_nonces: Single-use token and replay protection.forms_rate_limits: Per-form, per-IP sliding-window rate limits (resettable via$forms->resetRateLimit($slug, $ip)).forms_ab_counters: Atomic funnel counters (served,interacted,failed,completed) forAbTestManager.
Page-Editor Companion Suite (FieldtypeForms, InputfieldForms, FormsField)
Section titled “Page-Editor Companion Suite (FieldtypeForms, InputfieldForms, FormsField)”Attach a FieldtypeForms field to any ProcessWire template so editors can pick a form directly on a page:
- Stores
data(form slug) +options_json(per-pagethemeoverride indefault|modern|bareandajaxoverride). - Exposes immutable
FormReferenceValue(slug(),theme(),ajax(),isEmpty(),toArray()). - Implements
InertiaFieldtypeInterface(toInertiaFieldValue(),toInertiaPhpType(),toInertiaTsType(),toInertiaTsDefinitions()) for seamless Inertia frontends. - Configurable via
FormsField(renderModeFormatted:'markup' | 'definition' | 'slug',defaultTheme,allowPerPageOverrides).