---
title: Multi-Step Form Wizard
product: Form Library
description: Build a multi-step form where each page acts as a step. Add a progress bar or table of contents to help users navigate between steps. View a free JavaScript form wizard generator demo.
framework: Vanilla JS
source: https://surveyjs.io/form-library/examples/multi-step-form-wizard/vanillajs
index: https://surveyjs.io/form-library/examples/overview.md
---

# Multi-Step Form Wizard (Vanilla JS)

A multi-step form (form wizard) divides a long form into a sequence of smaller steps. In SurveyJS, you can implement this pattern either by defining multiple pages or by setting [`questionsOnPageMode`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionsOnPageMode) to `"questionPerPage"`. This configuration converts your form into a multi-step wizard where users navigate between steps (each representing a single question or a group of related questions) using Previous / Next buttons.

To build a form wizard in SurveyJS using question-per-page mode, follow these steps:

1. Enable question-per-page mode.         
Set [`questionsOnPageMode`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionsOnPageMode) to `"questionPerPage"` on the survey model (or in JSON). The survey will display elements one at a time in their defined order.

2. Organize the survey JSON schema.          
In question-per-page mode, the survey advances through elements sequentially, regardless of how they are grouped into [pages](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#pages). To display multiple questions within a single step, group them in a [panel](https://surveyjs.io/form-library/documentation/api-reference/panel-model). You do not need to create one page per step.

3. *(Optional)* Add a progress indicator.          
For longer forms, enable a [progress bar](https://surveyjs.io/form-library/examples/configure-form-navigation-with-progress-indicators/) to show completion status. The [`progressBarType`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#progressBarType) value `"questions"` is well suited to this pattern because each step corresponds to a single question.

Refer to the JSON listing for a complete example.

## Files

### `public/index.html`

```html
<div id="surveyElement" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-height: 100%; height:100%"></div>
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/index.js`

```js
import { Model } from "survey-core";
import "survey-js-ui";
import "survey-core/survey-core.min.css";
import "./index.css";
import { json } from "./json";

const survey = new Model(json);
survey.onComplete.add((sender, options) => {
    console.log(JSON.stringify(sender.data, null, 3));
});

survey.render(document.getElementById("surveyElement"));
```

### `src/json.js`

```js
export const json = {
  "title": "Multi-Step Registration",
  "description": "Create your account in a few quick steps.",
  "questionsOnPageMode": "questionPerPage",
  "showProgressBar": true,
  "progressBarType": "questions",
  "showPreviewBeforeComplete": true,
  "storeOthersAsComment": false,
  "completedHtml": "<h3>Thank you!</h3><p>Your registration has been submitted.</p>",
  "pages": [
    {
      "name": "about-you",
      "title": "About you",
      "elements": [
        {
          "type": "text",
          "name": "fullName",
          "title": "Full name",
          "placeholder": "John Doe",
          "autocomplete": "name"
        },
        {
          "type": "text",
          "name": "email",
          "title": "Email address",
          "inputType": "email",
          "placeholder": "you@example.com",
          "autocomplete": "email",
          "validators": [
            {
              "type": "email"
            }
          ]
        }
      ]
    },
    {
      "name": "preferences",
      "title": "Preferences",
      "elements": [
        {
          "type": "radiogroup",
          "name": "role",
          "title": "Which option best describes you?",
          "choices": [
            "Developer",
            "Product manager",
            "Designer"
          ],
          "showOtherItem": true,
          "otherText": "Other (please specify)"
        },
        {
          "type": "panel",
          "name": "feedback-panel",
          "title": "Additional information",
          "elements": [
            {
              "type": "comment",
              "name": "comments",
              "title": "Anything else we should know?",
              "maxLength": 500,
              "placeholder": "Optional"
            }
          ]
        }
      ]
    }
  ],
  "headerView": "advanced"
};
```

### `src/theme.js`

```js
export const themeJson = {};
```

### `package.json`

```json
{
  "dependencies": {
    "survey-core": "latest",
    "survey-js-ui": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/multi-step-form-wizard/angular.md)
- [React](https://surveyjs.io/form-library/examples/multi-step-form-wizard/reactjs.md)
- [Vue 3](https://surveyjs.io/form-library/examples/multi-step-form-wizard/vue3js.md)
- [jQuery](https://surveyjs.io/form-library/examples/multi-step-form-wizard/jquery.md)
