Skip to content

Multi-step forms ​

Phase 11 pages a form when definition.steps contains two or more steps. Zero or one step keeps the single-page markup from Phase 4.

There is no per-step save. One submit at the end stores the entry.

Schema ​

json
{
  "steps": [
    {
      "id": "step_intro",
      "title": "About you",
      "description": "",
      "next_label": "",
      "prev_label": ""
    },
    {
      "id": "step_message",
      "title": "Message",
      "description": "",
      "next_label": "",
      "prev_label": ""
    }
  ]
}

Each field may set step to a step id (same pattern as field IDs). Empty or unknown values render on the first step. Submit fields always render on the last step.

Empty next_label / prev_label fall back to the translated strings “Next” and “Back”.

Runtime ​

Dingfelder\AdForm\Steps\StepEngine sanitizes the list, generates stable IDs (step_ + 8 hex), regenerates duplicates, and groups fields into pages.

FormRenderer then:

  • Adds data-ad-form-paged="1" and ad-form--paged on the <form>
  • Prints a progress list (hidden until JS runs)
  • Wraps each page in .ad-form__step
  • Prints Back/Next buttons (type="button", hidden until JS runs)
  • Keeps every input enabled so classic POST still includes later pages

Without JavaScript every step is visible and the visitor submits once. With JavaScript, form.js adds ad-form--paged-js, shows progress/nav, and hides inactive steps with CSS. Next validates required fields on the current step that are not is-conditionally-hidden. Server validation still runs on all visible (condition) fields at submit.

Enter on an earlier step advances instead of submitting.

Builder ​

Form settings expose Enable steps. That creates two default pages, assigns non-submit fields to the first and submit fields to the last, and groups the canvas by step headers. Field inspectors can move a field between steps.

PHP ​

  • Dingfelder\AdForm\Steps\StepEngine
  • FormDefinition first-class steps and field step
  • FormJsonSchema::step()

Digitale Lösungen. Persönlich. Zukunftssicher.