Question T15115
Visible to All Users

How to make JSON tab read-only?

created a year ago (modified a year ago)

[Ticket cloned from T15084: Unexpected behaviour when pageEditMode is bypage for onElementAllowOperations allowDelete]

Hi Jane,

Thanks for your reply, I will wait for further updates.

Thanks for notifying me regarding the onCollectionItemAllowOperations, I will add this.

One last question: it is possible to make the json editor read only to avoid deleting pages/questions/panels?
The scenario would be: check if any of the pages/questions/panels is locked, if locked then make the json editor read only.

Thanks,

Eric

Answers approved by surveyjs Support

created a year ago

Hi Eric,
To disable editing for a JSON Editor tab, implement the creator.onActiveTabChanging function and set the creator.readOnly property when the current active tab is JSON Editor:

JavaScript
creator.onActiveTabChanging.add((sender, options) => { creator.readOnly = options.tabName === "editor"; });

View CodeSandbox

Let me know if you have any further questions.

Thanks

We hope you enjoyed the level of service you received. If so, we would love if you could leave your feedback on SurveyJS page at g2.com. As we’re building our business, every review helps build credibility for future customers and your feedback would be greatly appreciated.

    Comments (2)

      Hi Jane,

      Thanks the solution.

      Eric

        You're always welcome, Eric! Please feel free to contact us if you have any further questions.