I'm using the following jQuery Formbuilder (http://formbuilder.readthedocs.io/en/latest/formBuilder/options/typeUserDisabledAttrs/)
Docs indicate you can disable a field attribute as follows:
var options = {
typeUserDisabledAttrs: {
'text': [
'name',
'description',
]
}
};
$(container).formBuilder(options);
However the above would apply to all text controls.
Is there anyway to disable attributes on default fields - These fields appear on all forms and person configuring the form should not be allowed to remove the fields nor change some attributes such as the name etc.
var options = {
defaultFields: [
{
"type": "text",
"required": true,
"label": "Subject",
"className": "form-control",
"name": "Subject",
"subtype": "text",
"disabledFieldButtons": ['remove']
}],
disabledActionButtons: ['clear']
};
$(container).formBuilder(options);
I've figured out a soultion by doing the following:
typeUserEvents: {
text: {
onadd: function (fld) {
var $nameField = $('.fld-name', fld);
if ($nameField.val() == "Subject")
$nameField.prop('disabled', true);
}
}
}