surveyjs / survey-creator

Scalable open-source survey software to generate dynamic JSON-driven forms within your JavaScript application. The form builder features a drag-and-drop UI, CSS Theme Editor, and GUI for conditional logic and form branching.
https://surveyjs.io/open-source
Other
924 stars 378 forks source link

By Page Mode: Display the relevant caption (e.g. Add New) for a new page which doesn't yet exist #3775

Open JaneSjs opened 1 year ago

JaneSjs commented 1 year ago

In By Page mode, the last navigation page element is actually a page which doesn't yet exist. Please use another tooltip text to indicate that this is not a real page.

Original issue: T11741 - Change ghostpage / lastpage text in pageselector.

JaneSjs commented 1 year ago

Handle the creator.onGetObjectDisplayName event to supply a custom display name for the last page in a page selector. Check whether a page is not included into a survey.pages collection and specify a custom options.displayName: example.

 creator.onGetObjectDisplayName.add(function (sender, options) {
    if (options.obj.getType() === "page") {
      if (!options.obj.survey.pages.includes(options.obj)) {
        options.displayName = "Add New";
      }
    }
});