Question T13015
Visible to All Users

Change Any Question default name, title, and description

created 2 years ago

Hello Dears,

i'm using angular, and i want to change the default name of any question type, let's say i want to change the panel defualt name (panel1, panel2) to a custom name, and i want to add a default title and description to it, how can i do that.

Answers approved by surveyjs Support

created 2 years ago

Hello Hani,
You can use creator.onPanelAdded event.
It is not related to the rendering and as result you will have the same code for all JavaScript platforms.

JavaScript
creator.onPanelAdded.add((sender, options) => { const panel = options.panel; panel.name = "youNewName"; panel.title = "youNewTitle"; panel.description = "youNewDescription"; });

"panel.name" should be unique. You can check it as "creator.survey.getPanelByName("yourNewName")" If it returns null then there is no panel with this name. Otherwise you need to use another name.

Thank you,
Andrew
SurveyJS Team

    Show previous comments (8)

      i also get this error now

      cannot read properties of undefined (reading 'initKeyboardShortcuts')
      at CreatorComponent.ngAfterViewInit (survey-creator-angular.js:142:22)
      at callHook (core.mjs:2577:22)
      at callHooks (core.mjs:2546:17)
      at executeInitAndCheckHooks (core.mjs:2497:9)
      at refreshView (core.mjs:11853:21)
      at refreshComponent (core.mjs:12921:13)
      at refreshChildComponents (core.mjs:11572:9)
      at refreshView (core.mjs:11832:13)
      at refreshEmbeddedViews (core.mjs:12875:17)
      at refreshView (core.mjs:11806:9)
      handleError @ core.mjs:6402

        Hello,

        I created a separate ticket on your behalf: T13066: Survey Creator for Angular doesn't include all languages. We placed it in our processing queue and will process it shortly.

          To process your additional inquiry, I created a separate ticket: Survey Creator for Angular - The cannot read properties of undefined (reading 'initKeyboardShortcuts') exception occurs.

          Please refer to it for further details.