Question T8557
Visible to All Users

Changing Question Types (React V2)

created 3 years ago

Seeing a possible regression in functionality in the new React V2 version of the Survey Creator. The use case I have is I'm importing in existing survey questions from another tool and converting it to SurveyJS formatting. A majority of questions cannot have their question content change, just the display formatting to keep the data the same but the visuals different. In the new Creator, when I go to change the question type as shown in the picture below, it allows me to change it to non compatible types that result in data loss. Ex. if I try to change a question from Radiogroup to Single Input, the JSON is updated and removes all answers. But if I change it to a single select drop down it's all compatible and can be swapped around without data loss. The original Knockout JS version limited the list to what was compatible. Is there a new way to toggle that functionality or is this a regression?

Old Functionality: Changing an existing question type to another type was limited to compatible types by data
New functionality (bug): Changing an existing questions type is now open to all types enabled for the editor regardless of compatibility

Clipboard-File-1.png

Answers approved by surveyjs Support

created 3 years ago

Hello Darren,
It was done by on purpose. Our designer asked us to do it in this way. End-user can always use undo/redo functionality.
The idea, that end-user could click on "Add Question" button several times and then change the question type as he/she needs. That is a valid use case and some people prefer to create new questions in this way.
However, you can go to the old style, by using the following code:

JavaScript
SurveyCreator.settings.questionConvertMode = SurveyCreator.QuestionConvertMode.CompatibleTypes; //the default is AllTypes.

Thank you,
Andrew
SurveyJS Team

    Show previous comments (1)

      Hello Darren,
      Indeed, it doesn't recognize enum QuestionConvertMode, however, it is in d.ts file. Anyway, please use the following code instead:

      JavaScript
      SurveyCreator.settings.questionConvertMode = 1;

      The second constant in enum equals 1 in the actual code.
      Here is the working example.

      Thank you,
      Andrew
      SurveyJS Team

      DT DT
      Darren.Thompson 3 years ago

        That solved it, thank you so much! I also really appreciate the context for why the decision was made. Makes complete sense to be optional now.

          Great!

          Andrew
          SurveyJS Team