Hi,
we have a placeholder mechanism for our surveys that replaces certain substrings in the defaultValue of a question with context dependent values (external, not from the survey) when the survey is served.
Since there are quite a few placeholders and we don't want to just display a list of available placeholders to the users who create the surveys using the Survey Creator component, I replaced the entire defaultValue property with a custom text property that allows the users to insert placeholders via a dropdown.
This works quite nicely for questions of type text and comment but not so much for multipletext since the defaultValue of multipletext is an object and not just a string.
I came up with two possible solutions for multipletext but unfortunately I can't figure out how to make either work:
1.) display the default values of a multipletext question as a multipletext custom property
TypeScriptconst customDefaultMultiValue = {
name: 'customDefaultMultiValue',
displayName: 'Standardwerte',
category: 'data',
type: 'multipletext',
// items?
onSetValue: (question, value) => {
question.defaultValue = value;
}
};
Serializer.addProperty('multipletext', customDefaultMultiValue);
How can I set the items of a property of type multipletext?
I tried the following three variants but the property just renders as a single line.
JSON{ ... items: [ { 'name': 'line1' }, { 'name': 'line2' } ] }
JSON{ ... [value, defaultValue]: { 'line1': '', 'line2': '' } }
2.) customize the default value popup
I couldn't find any documentation, examples, older support tickets or articles on 3rd party websites that describe if it's possible to customize the default value popup and if so how to do it.
It would be great if I could add my placeholder selector to the existing default value popups instead of having to create custom properties.
Is this possible?