- Description:
This key defines whether the value of an input is editable in the Data Editor or the sidebar of the Visual Editor or Content Editor.
Disabled inputs are useful if you want CloudCannon to display the input value, but prevent team members from editing the value outside of the Source Editor.
The value of this key can be a boolean or a string. A boolean value of
truewill prevent team members from editing the value.A string value can prevent team members from editing an input based on the value of another input.
You can reverse the value with a
!character at the beginning.publishedhides an input when the sibling inputpublishedis truthy!publishedhides an input when the sibling inputpublishedis falsy
For reverse values in
YAMLfiles, the string should be in'or"quotation marks.By default, this key is
false(i.e., team members can edit input values).- Appears in:
└── _inputs └── * ├── Text Input │ └── disabled ├── Textarea Input │ └── disabled ├── Code Input │ └── disabled ├── Color Input │ └── disabled ├── Boolean Input │ └── disabled ├── Number Input │ └── disabled ├── Range Input │ └── disabled ├── Rich Text Input │ └── disabled ├── Date/Datetime Input │ └── disabled ├── Time Input │ └── disabled ├── File Input │ └── disabled ├── URL Input │ └── disabled ├── Select Input │ └── disabled ├── Multiselect Input │ └── disabled ├── Choice Input │ └── disabled ├── Multichoice Input │ └── disabled ├── Object Input │ └── disabled └── Array Input └── disabled- Default value:
false- Types:
This key represents a boolean value for the
disabledkey that toggles whether CloudCannon prevents editing of an input value.When set to
true, CloudCannon prevents team members from editing the input value in the Data Editor or the sidebar of the Visual Editor or Content Editor. The input value is still displayed but cannot be modified outside of the Source Editor.When set to
false, team members can edit the input value normally.By default, this key is
false(i.e., team members can edit input values).Show examplesHide examples
In this example, we have configured a datetime input to be disabled using a boolean value, preventing editors from modifying the automatically generated date.
Copied to clipboard_inputs: date_created: type: datetime label: Date of article creation disabled: true instance_value: NOW{ "_inputs": { "date_created": { "type": "datetime", "label": "Date of article creation", "disabled": true, "instance_value": "NOW" } } }This key represents a query string value for the
disabledkey that conditionally prevents editing of an input value based on another input's value.The value is a string that references a sibling input key name. CloudCannon evaluates the referenced input's value to determine whether to disable this input.
When the referenced input is truthy, CloudCannon disables this input. You can reverse this behavior by prefixing the string with
!.For reverse values in YAML files, the string should be wrapped in single or double quotation marks.
Show examplesHide examples
In this example, we have configured an input to be disabled when the
publishedinput is truthy.Copied to clipboard_inputs: published: type: checkbox label: Published edit_date: type: datetime label: Last edited disabled: published{ "_inputs": { "published": { "type": "checkbox", "label": "Published" }, "edit_date": { "type": "datetime", "label": "Last edited", "disabled": "published" } } }In this example, we have configured an input to be disabled when the
publishedinput is falsy using the!prefix.Copied to clipboard_inputs: published: type: checkbox label: Published draft_notes: type: textarea label: Draft notes disabled: '!published'{ "_inputs": { "published": { "type": "checkbox", "label": "Published" }, "draft_notes": { "type": "textarea", "label": "Draft notes", "disabled": "!published" } } }- Examples:
In this example, we have configured the
date_createdDate input, which will automatically populate when you create a file using this input. Editors cannot alter this input as the interface is disabled.Copied to clipboard_inputs: date_created: type: datetime label: Date of article creation comment: UTC +0 timezone disabled: true instance_value: NOW options: timezone: Etc/UTC{ "_inputs": { "date_created": { "type": "datetime", "label": "Date of article creation", "comment": "UTC +0 timezone", "disabled": true, "instance_value": "NOW", "options": { "timezone": "Etc/UTC" } } } }