Multistep
Methods for building and controlling multistep forms.
createMultistep
Builds and runs the whole wizard: renders the current step, validates it on submit, advances to the next step, and finishes with an automatic review page.
$steps = [ 'Contact Info' => [ 'fields' => [ 'name' => ['label' => 'Name', 'rules' => ['required']], 'email' => ['type' => 'email', 'label' => 'Email', 'rules' => ['required', 'email']], ], ], 'Preferences' => [ 'fields' => [ 'newsletter' => ['type' => 'checkbox', 'label' => 'Subscribe to newsletter'], ], ], ]; $form->createMultistep($steps);
Each array key is a step name, and fields uses the same format as create().
Validation is per step — each field's rules run when that step is submitted, the
step only advances when they pass, and errors display exactly as they do on a
single-page form.
Options (second argument):
| Option | Type | Default | Description |
|---|---|---|---|
auto |
bool | true |
Auto-generate breadcrumbs, headings, and the review page |
nextText |
string | 'Next' |
Default button text for steps |
reviewTitle |
string | 'Please Review the Information' |
Heading on the review page |
reviewText |
string | 'Review Your Information.' |
Instructions on the review page |
submitText |
string | 'Submit Form' |
Button text on the review page |
Returns the current step's markup when 'echo' => false (in the default echo mode
it prints immediately), and null once the form is complete. Requires an active
session — it throws a FlickException without one. See the
Multistep Forms guide for a full walkthrough.
multistepIsComplete
Checks if the multistep form submission is complete.
if ($form->multistepIsComplete()) { // handle completed form }
multistepFormData
Returns all submitted form data and, by default, clears the session. Note that
this clears the entire Flick session — including anything you stored with
addSessionValue() — not just the multistep data. Read anything you want to keep
first, or pass false to leave the session intact.
if ($form->multistepIsComplete()) { $data = $form->multistepFormData(); } // read the data without ending the wizard $data = $form->multistepFormData(false);
multistepCurrentStep
Returns the name of the current step, exactly as you wrote it in your form array
(or 'Review' during the review phase).
$currentStep = $form->multistepCurrentStep($formArray);
The name comes back raw, so it matches the keys multistepSteps() returns and
can be compared against them — which is how the breadcrumb views mark the active
step. Escape it yourself if you echo it into HTML:
<h2><?= htmlspecialchars($form->multistepCurrentStep($steps), ENT_QUOTES, 'UTF-8') ?></h2>
multistepCompletedSteps
Returns an array of completed step names.
$completed = $form->multistepCompletedSteps();
multistepSteps
Returns an array of all step names in the form.
$steps = $form->multistepSteps($formArray);
multistepIsInReview
Checks if the form is in the review step.
if ($form->multistepIsInReview()) { // Show review page }
multistepReviewData
Returns all submitted form data without clearing the session.
$reviewData = $form->multistepReviewData();
multistepBreadcrumbs
Generates breadcrumb navigation for the multistep form.
$form->multistepBreadcrumbs($formArray);
All bundled view themes include a breadcrumbs view. A custom theme must provide its
own breadcrumbs.view.php, or this method throws a RuntimeException.
submitMultistep
Generates the submit button for a multistep form.
$form->submitMultistep('Submit Form'); // custom attributes replace the default button styling $form->submitMultistep('Submit Form', 'class="my-button" data-step="final"');
With no attributes the button uses your configured view theme's default button
classes (from the theme's multistep-submit.view.php). Passing a string (or an
array) of attributes replaces that default styling entirely, so your class
never collides with the built-in one.