Question T6822
Visible to All Users

Survey Creator: Disable editing for some questions

created 4 years ago

Hi there,

Is it possible to disable editing for particular questions on Create Survey page? I have to implement the following scenario: user opens survey creator to edit survey with already existed questions and all these questions should be disabled for any editing(delete, edit, dragging) but all questions which user adds in this session should be editable and deletable.

The second question: is it possible to set answer for question in Survey Creator mode? For example user answered questions and then admin wants to edit survey(add new questions) and admin wants to see answers at the same time.

It there an option to add custom buttons in the footer of Survey Creator?

Answers approved by surveyjs Support

created 4 years ago

Hello,

You can use the https://surveyjs.io/Documentation/Survey-Creator?id=surveycreator#onElementAllowOperations and https://surveyjs.io/Documentation/Survey-Creator?id=surveycreator#onGetPropertyReadOnly events to limit object editing:

JavaScript
creator.onElementAllowOperations.add(function(sender, options) { if(options.obj.name === "question1") { options.allowDelete = false; options.allowEdit = false; options.allowCopy = false; options.allowAddToToolbox = false; options.allowDragging = false; options.allowChangeType = false; options.allowChangeRequired = false; options.allowShowHideTitle = false; } }); creator.onGetPropertyReadOnly.add(function(sender, options) { if(options.obj.name === "question1") { options.readOnly = true; } });

Here is the working sample - https://plnkr.co/edit/eTtZU98vcgqAhZLi

The options.obj is a question of a survey and you can use different conditions to disable editing for it.

Thanks, Serge
SurveyJS Team

    Comments (2)

      How can I get all questions in Survey Creator?

        Hello,

        I created a separate ticket on your behalf: (T6829: How can I get all questions in Survey Creator?). We placed it in our processing queue and will process it shortly.

        Thanks, Serge
        SurveyJS Team