survey-creator
survey-creator copied to clipboard
Design Mode - Add an option to specify a panel title placeholder
T22684 - Panel Title Placeholder https://surveyjs.answerdesk.io/internal/ticket/details/T22684
A panel's description placeholder is specified as follows:
Serializer.getProperty("panel", "description").placeholder = Enter panel description";
A panel's title placeholder cannot be specified using the Serializer API. It's necessary to use the following code.
const updateDefaultTitle = (panel) => {
panel.locTitle.onGetTextCallback = (text) => {
if (!text) {
debugger;
return "Enter Panel Title";
}
return text;
};
panel.locTitle.strChanged();
};
creator.onSurveyInstanceCreated.add((sender, options) => {
if (options.area === "designer-tab") {
options.survey.getAllPanels().forEach((q) => {
updateDefaultTitle(q);
});
options.survey.onPanelAdded.add((sender, options) => {
updateDefaultTitle(options.panel);
});
}
});