Hello,
As I'm evaluating SurveyJS (prior to getting a commercial license), and the docs have many examples using old versions as well, I find myself searching all over the place.
Curious, how to fully hide/remove the options in the general tab indicated with a red rectangle?
Ideally, these options are not visible at all, and are set as follows:
- title always shows
- language is "en"
- the survey is editable (but later I may change it to read-only if someone is viewing their survey after completion)
- no cookie name
- width is responsive
- fit to container is checked (I've played around with this option and did not see a difference)
Here's my current setup:
JavaScriptimport 'survey-core/defaultV2.min.css';
import 'survey-creator-core/survey-creator-core.min.css';
import { SurveyCreator, SurveyCreatorComponent } from 'survey-creator-react';
//import { Serializer } from 'survey-creator-core';
const questionTypes = [
'question',
'text',
'checkbox',
'radiogroup',
'dropdown',
'boolean',
'matrix',
'rating',
'ranking',
'comment',
'panel',
'html',
];
const options = {
showJSONEditorTab: false,
showLogicTab: false,
showPreviewTab: false,
showToolbox: false,
isAutoSave: true,
questionTypes: questionTypes,
};
const SurveyDesign = () => {
const creator = new SurveyCreator(options);
creator.onPropertyGridSurveyCreated.add((sender, options) => {
const generalTab = options.survey.getPanelByName('general');
const logicTab = options.survey.getPanelByName('logic');
const completedTab = options.survey.getPanelByName('showOnCompleted');
const timerTab = options.survey.getPanelByName('timer'); // showTimerPanel
if (completedTab) {
completedTab.delete();
}
if (timerTab) {
timerTab.delete();
}
});
creator.JSON = {};
return (
<div className="att-survey-designer" style={{ height: '80vh' }}>
<SurveyCreatorComponent creator={creator} />
</div>
);
};
export default SurveyDesign;
Also, while at it. Where can we find a list of the names for each of the property grid panels and items? You can see from my example above that I'm just guessing and using various examples/demos to understand the names like "timer":
const timerTab = options.survey.getPanelByName('timer'); // showTimerPanel
So the whole idea of me looking at SurveyJS is to give our own users the power to create surveys, and therefore creating less thinking for them by removing options we don't need. Thanks!
Hello Petar,
You can iterate through all panels to find out their names using this code:
options.survey.getAllPanels().forEach(p => console.log("Name: " + p.name + ", title: " + p.title));
.To hide individual properties, you can use creator.onShowingProperty event, as shown in this example.
Thank you,
Andrew
SurveyJS Team
Thanks Andrew.
You are welcome!
Thank you,
Andrew
SurveyJS Team