23. Multi-Step Forms | Form Forge - Build Forms with AI in Seconds
Download Log in

23. Multi-Step Forms

Developer Guide

Multi-step forms break a long form into smaller pages with a progress bar and Back/Next navigation. Created by inserting page_break fields. PRO feature.

Field Configuration

json
{
  "fields": [
    {"id": "field_1", "type": "text", "label": "Name", "required": true},
    {"id": "field_2", "type": "email", "label": "Email", "required": true},
    {"id": "pb_1", "type": "page_break", "label": ""},
    {"id": "field_3", "type": "textarea", "label": "Message", "required": true},
    {"id": "field_4", "type": "rating", "label": "Rating", "required": false},
    {"id": "pb_2", "type": "page_break", "label": ""},
    {"id": "field_5", "type": "checkbox", "label": "I agree to the terms", "required": true}
  ],
  "settings": {
    "multi_step": true
  }
}

This creates: Step 1 (Name, Email) -> Step 2 (Message, Rating) -> Step 3 (Terms, Submit).

Step Validation Behavior

  1. On page load, only Step 1 is visible; the progress bar shows “Step 1 of 3”
  2. Clicking “Next” validates the current step’s required fields
  3. If all valid, the current step hides and the next step slides in
  4. “Back” always works without validation
  5. On the final step, the “Next” button is hidden and the “Submit” button is shown

Creating a Multi-Step Form Programmatically

php
$form_id = FORMFORGE_Form_Builder::instance()->create( [
    'title'  => 'Multi-Step Registration',
    'fields' => [
        [ 'id' => 'field_1', 'type' => 'text', 'label' => 'First Name', 'required' => true ],
        [ 'id' => 'field_2', 'type' => 'email', 'label' => 'Email', 'required' => true ],
        [ 'id' => 'pb_1', 'type' => 'page_break', 'label' => '' ],
        [ 'id' => 'field_3', 'type' => 'phone', 'label' => 'Phone', 'required' => false ],
        [ 'id' => 'field_4', 'type' => 'select', 'label' => 'Role', 'required' => true,
          'options' => [
              [ 'value' => 'developer', 'label' => 'Developer' ],
              [ 'value' => 'designer', 'label' => 'Designer' ],
          ] ],
        [ 'id' => 'pb_2', 'type' => 'page_break', 'label' => '' ],
        [ 'id' => 'field_5', 'type' => 'checkbox', 'label' => 'I agree to the terms', 'required' => true ],
    ],
    'settings' => [
        'multi_step'      => true,
        'submit_text'     => 'Complete Registration',
        'success_message' => 'Registration complete!',
    ],
] );

Forge AI Assistant Online

Hi! I'm the Form Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs