Question T7274
Visible to All Users

Adding in a Button that takes you to a next Panel rather than a next Page

created 4 years ago

Hi there,

After my users have finished with a dropdown panel of questions, i would like it so that they can "complete" the panel and then the current panel closes and causes the next panel to open.

Is there a way to adda button in survey JS ? If there isn't what would be a way to do it outside ?

Cheers,

Answers approved by surveyjs Support

created 4 years ago

Hello,

Is there a way to add a button in survey JS ?

In short the answer is yes. You haven't described your scenario in details thus my answer will be rather general.

You can use the https://surveyjs.io/Documentation/Library?id=surveymodel#onAfterRenderPanel event to add a custom button to a panel. In your button click handler you can find the a panel using the https://surveyjs.io/Documentation/Library?id=surveymodel#getPanelByName method of a survey model or the https://surveyjs.io/Documentation/Library?id=surveymodel#getAllPanels method to iterate through all panels to find a panel. Panel has the https://surveyjs.io/Documentation/Library?id=panelmodel#expand and https://surveyjs.io/Documentation/Library?id=panelmodel#collapse methods to control it content visibility.

In order to check whether the panel is completed you can iterate through the https://surveyjs.io/Documentation/Library?id=panelmodel#questions of the panel and check the https://surveyjs.io/Documentation/Library?id=Question#isEmpty method of the every question in this panel.

Thanks, Serge
SurveyJS Team