Search code examples
surveyjs

Does SurveyJS have a built-in way to specify "show N questions per page"


We are using Survey Creator to allow our users to build questionnaires. However, we want to keep it simple and we don't want them to have to deal with pagination.

In other words, in the builder, we want to disable pages (showPagesToolbox = false) and have them create a set of questions all on a single page.

When we present this to respondents, we want them to see a single question per page. I.e. Q1 is on page 1, Q2 is on page 2, etc.

Does the SurveyJS library provide a way of handling this situation, i.e. here are all the questions, show them with N questions per page?


Solution

  • There is an option, whch allows you to automatically display one question per page. To enable this you need to set "questionsOnPageMode": "questionPerPage" on the survey level. Here's an example:

    {
     "pages": [
      {
       "name": "page1",
       "elements": [
        {
         "type": "text",
         "name": "question1"
        },
        {
         "type": "checkbox",
         "name": "question2",
         "choices": [
          "item1",
          "item2",
          "item3"
         ]
        }
       ]
      }
     ],
     "questionsOnPageMode": "questionPerPage"
    }
    

    This is also configurable through the SurveyJS creator by opening the "Survey Settings" dialog, then going to the "Navigation" section, and finally setting the "Questions on page mode" value.

    Unfortunately at this time there is no option to specify N number of questions per page. The documentation for this setting is here.