Question T9464
Visible to All Users

Change default question type

created 3 years ago

I'm trying to implement creator with options when you have only one question type: "radiogroup", but the Button of adding the question is stll adds "text" type question

My configs:

JSON
const creatorOptions = { showLogicTab: false, showJSONEditorTab: true, questionTypes: [ "radiogroup" ], pageEditMode: "single", showTitlesInExpressions: false, allowEditExpressionsInTextEditor: false, showSurveyTitle: "never", JSON: defaultJson };

Is it possible to change default question type?

Image attached

Answers approved by surveyjs Support

created 3 years ago

Hello,

Yes, it is possible to change the default question type. Please use the following code:

JavaScript
SurveyCreator.settings.designer.defaultAddQuestionType = "radiogroup";

Olga,
SurveyJS Team

    Comments (3)

      Are you sure?
      I've tried it on your codesandbox, and it's not possible to access SurveyCreator.settings.

      Here's forked example: https://codesandbox.io/s/dreamy-goldwasser-xcg1ov

        Hello,

        For CodeSandbox (or any webpack/react-scripts project) you need to import settings and use it without module name.
        I fixed your example, check it out: https://codesandbox.io/s/shy-mountain-g7l5cy?file=/src/SurveyCreatorComponent.jsx

        Thank you,
        Alex
        SurveyJS Team

          Got it. Now it works! Thanks a lot Alex!