Multi-Step Forms

Creating and managing multi-step forms with progress indicators, step navigation and conditional step logic.

Overview

The FormStep model lets you break long forms into logical sections with progress tracking. Steps support conditional display, custom icons, per-step validation and flexible navigation. When a form has steps, it automatically renders in multi-step mode.

Core Properties

PropertyTypeDescription
titlestringStep title displayed in progress indicator
descriptionstring|nullOptional step description or instructions
iconstring|nullIcon name for step indicator (optional)
sort_orderintDisplay order of steps (0-indexed)
conditionsarrayConditional logic to show/hide step

Creating Multi-Step Forms

Use the FormBuilder's addStep() method to define steps and assign fields:

app/Http/Controllers/FormController.php

Step Navigation Settings

Control multi-step behavior through form settings:

SettingDefaultDescription
show_progress_bartrueDisplay progress indicator showing current step
show_step_navigationtrueShow next/previous buttons between steps
validate_on_step_changetrueValidate current step before allowing navigation
allow_save_draftfalseEnable saving progress as draft submission
allow_step_jumpingfalseAllow clicking any step in progress bar (vs. sequential)
show_step_numberstrueShow step numbers (1, 2, 3) in progress indicator

Conditional Steps

Steps can be shown or hidden based on field values from earlier steps:

Relationships

  • form - BelongsTo Form (parent form)
  • fields - HasMany FormField (fields in this step)

Frontend Usage

The PolyformMultiStepRenderer component handles the multi-step UI out of the box:

resources/js/Pages/Survey.vue

The usePolyformSteps composable gives you reactive step state and navigation methods.

Programmatic Step Creation

You can also create steps directly via Eloquent:

Step Validation

With validate_on_step_change enabled, only the current step's fields are checked before navigation. On final submission, all steps are validated together.

Draft Submissions

Turn on allow_save_draft to let users save progress and come back later:

  • Draft submissions have status STARTED
  • Users can resume from their last completed step
  • Drafts are scoped to the authenticated user (requires login)
  • Final submission changes status to SUBMITTED

Best Practices

  • Keep steps to 3-7 fields each for a good user experience
  • Use clear step titles that tell users what to expect
  • Enable validation on step change to catch errors early
  • Group related fields together (e.g., Contact Info, Preferences, Review)
  • Think about mobile users when planning the step flow
  • Show a progress bar for forms with more than 3 steps