[Ticket cloned from T2383: Removing properties for questions created by custom toolbox item]
Hi,
I want to hide 'readOnly' property to my custom Item.
My toolbox item:
JavaScriptcreator.toolbox.addItem({
name: "clientinfofield",
isCopied: true,
iconName: "icon-default",
title: "Información del Cliente",
json: {
'type': "text",
'customType': 'clientinfofield',
optionsCaption: "Select a country...",
readOnly: true,
showReadOnly: false,
choices: [
{
value: "clientRef",
text: "Client REF"
}
]
}
});
I'm trying with these options, but don't work:
1.Survey.Serializer.addProperty("clientinfofield", {name: "readOnly", visible: false});
2.If you see, I added a custom property in json object 'customType', to try get it here and hide the property:
JavaScriptformCreator
.onShowingProperty
.add(function (sender, options) {
if (options.obj.customType == "clientinfofield" && options.property.name == "readOnly") {
options.canShow = false;
}
});
any idea?, or can I not allow to user change that property for my custom toolbox item?.
Hello Cristian,
Your type is still text: 'type': "text", We do not have property as "customType" in our question.
I would suggest you to learn about our Component Questions. We just released it in v1.7.1.
You can see your example with countries at the start and here is the section about overriding/hiding question properties.
Thank you,
Andrew
SurveyJS Team
Hi Andrew,
Ok, I will check it.
Thanks,