Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A public API for hiding individual triggers from the Property Grid and the Logic tab is missing #6031

Closed
JaneSjs opened this issue Nov 4, 2024 · 0 comments · Fixed by #6106
Assignees
Labels
user issue An issue or bug reported by users.

Comments

@JaneSjs
Copy link
Contributor

JaneSjs commented Nov 4, 2024

Implemented

Since Survey Creator v1.12.11, you can use the following code to hide triggers from the Property Grid and the Logic tab:

import { settings } from "survey-creator-core"

// Hide the "complete" and "skip" triggers
settings.logic.invisibleTriggers = ["complete", "skip"];

History


The following code hides the Complete Survey trigger from the Logic Tab:

import { SurveyLogic } from "survey-creator-core";

SurveyLogic.types.forEach(function (logicType) {
  if (logicType.name === "trigger_complete") {
    logicType.showInUI = false;
  }
});

The following code hides the Complete Survey trigger from the property grid:

import { Serializer } from "survey-core";

Serializer.removeClass("completetrigger");

Demo

Issues with this:

  • No single function/API to remove the Complete trigger from all places within a Creator UI.
  • If you do not run the first piece of code but remove the Complete trigger using the Serialization API, the Complete trigger remains available in the Logic tab and the following exception is thrown on an attempt to setup a Complete trigger:
Uncaught TypeError: Cannot set properties of null (setting 'survey')
    at e.createNewObj (survey-creator-core.min.js:2:303575)
    at t.createElementPanelObj (survey-creator-core.min.js:2:531707)
    at t.updatePanelElements (survey-creator-core.min.js:2:534457)
    at t.onLogicTypeChanged (survey-creator-core.min.js:2:546334)
    at Array.<anonymous> (survey-creator-core.min.js:2:535901)
    at e.fire (survey.core.min.js:6:173545)
    at t.dynamicPanelItemValueChanged (survey.core.min.js:6:831104)
    at t.setPanelItemData (survey.core.min.js:11:72322)
    at e.setValue (survey.core.min.js:11:26336)
    at t.setValueCore (survey.core.min.js:6:363357)
@JaneSjs JaneSjs added the user issue An issue or bug reported by users. label Nov 4, 2024
@RomanTsukanov RomanTsukanov changed the title Introduce a public API for hiding the Complete Survey trigger from the Logic tab A public API for hiding individual triggers from the Logic tab is missing Nov 20, 2024
@RomanTsukanov RomanTsukanov changed the title A public API for hiding individual triggers from the Logic tab is missing A public API for hiding individual triggers from the Property Grid and the Logic tab is missing Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user issue An issue or bug reported by users.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants