survey-creator
survey-creator copied to clipboard
Add an option to display the Add Question button on the last page of an existing form
T18190 - Visibility of the "Add new question" button limited to the last page or with the option to add at the beginning of the creator https://surveyjs.answerdesk.io/internal/ticket/details/T18190
In a usage scenario, the Add Question button should be visible only on the last page of an existing survey form.
In the meantime, it is possible to use ComputedUpdater to display the Add Question button on the last page: View Demo.
import { ComputedUpdater } from "survey-core";
creator.onGetPageActions.add((sender, options) => {
const addQuestionAction = options.actions.filter(action => action.component === "svc-add-new-question-btn")[0];
if(!!addQuestionAction){
addQuestionAction.visible = new ComputedUpdater((data) => {
const pageIndex = addQuestionAction.data.surveyElement.visibleIndex;
const pageNumber = creator.survey.pageCount;
return pageIndex === pageNumber - 1;
});
}
})
Please consider adding an option to display the Add Question button only on the last page of an existing survey.