A Data Definition is a collection of XML data that has been authored manually or by use of the data definition builder (/common/data definition builder), and it describes how a certain set of data is structured. Data definitions are used by Cascade Server to generate form-based input fields for the creation and editing of page content, as well as to generate XML data from the input provided by users in input fields.
Data Definitions provide structured authoring capabilities, which allow non-technical users to enter content in a series of form fields to create structured pages without the need for additional formatting. These fields are automatically styled using an XSL stylesheet.
Cascade’s ability to provide full design control for custom pages, in addition to custom fields, including text, WYSIWYG, drop-down menus, check boxes, and radial buttons, contributes to a faster and more efficient content creation process.
An example of how a data definition may be used follows:
An article in an online magazine might be described as follows:
When applied to a page, a series of form input fields would be present: two text fields ('Headline' and 'Location'), a text field with a calendar chooser (‘Date’), a file chooser ('Image'), and a multi-line WYSIWYG text field ('Main Content'). When this form is completed, the CMS uses the data definition to make the data available as XML, like so:
Note that even though the <image-file> tag displayed above contains a <path> tag, the relationship between the current Page and the selected image is maintained using the id of the File asset representing the image. This means that if a user renames the File or changes its parent Folder, this field will still link to the File; and the <path> tag will be updated with the File's new path. Deleting the File from Cascade Server will result in this field being empty (no File selected). After the File is deleted, creating a new File with path /plea-for-help-online/images/well.gif will not re-populate this field because the new File, even though it has the same path as the original, will have a different id. This concept applies to all types of asset choosers.
This XML data can then be transformed by an XSLT stylesheet for the purposes of presentation or multi-purposing of content. Data definitions allow for definition of structure, which all data of a specific type should exhibit, and make automation of presentation and repurposing possible.
Data Definitions Overview
There are five basic conceptual steps in creating and implementing a Data Definition:
- Use the Drag and Drop Data Definition builder, or write a Data Definition by hand in XML.
- Assign the Data Definition to a page via the page system settings.
- Edit the page, and fill in the form capture fields from the Data Definition.
- View the XML as outputted from the Data Definition, and write a corresponding XSLT Format to transform it to the desired output.
- Apply the format to the page’s DEFAULT region to transform the content (do not supply a block for the DEFAULT region, as the data definition XML is automatically placed there).
See below for step-by-step instruction in creating Data Definitions, attaching Data Definitions, and applying Formats to Data Definitions.
Creating a Data Definition
Structured authoring is a way to allow non-technical users to enter content into a series of fields without the need for additional formatting via the WYSIWYG. Instead, pages using structured authoring allow users to type plain text into various fields or select various options. These structured fields are automatically styled using an XSL stylesheet. The resulting page is automatically formatted to fit preset requirements. In Cascade Server, structured authoring is accomplished using a Data Definition.
To create a Data Definition:
- In the Administration area, select ‘Data Definitions’ from the left navigation pane.
- Navigate to the container in which the new data definition will be stored, or create a new container.
- Click "New Data Definition"
- Complete the following fields in the "General" pane.
- Name – A descriptive name for your definition.
- Parent Container – This value will be set to the current container, but can be changed if desired by clicking on the chooser icon.
- If using the drag-and-drop Data Definition builder, on the "General" pane is where you can drag fields/tools into the Data Definition.
- If you'd like to enter your own XML, on the "XML" pane:
- XML – Enter XML content.
When creating Data Definitions, users have the option to either use the drag and drop Data Definition builder, or to build them from scratch using XML. If entering XML to construct a Data Definition, the edit-area syntax highlighter will be on by default. If you wish to turn it off, simply uncheck the "Advanced Editor" checkbox. However, please note, doing so will only turn the advanced editor off for that single use of the editor. Upon creating a template or editing a template, the advanced editor will be on by default.
- File Upload – As an alternative to entering content in the XML field, data definition XML content may be entered here.
- Click "Submit" to save the Data Definition.
Applying a Format to a Data Definition
Click the Edit tab, and select the Configurations pane to display available configurations.
The default configuration (HTML) will be shown. Click the browse icon located next to format in the DEFAULT region row.
Select a Format, and click Confirm in the browse icon window.
Click the Submit button to record the change.
The page will be visible, except the XML data from the data definition has been transformed into standard HTML and output in the default region. This will include formatting such as spacing, bold, and hyperlinks.
Attaching a Data Definition to a Page
To attach a Data Definition to a page:
- In the Home area, navigate to the desired page, and click on the ‘Edit’ tab.
- In the System pane, locate "Data Definition."
- Click on the chooser next to the Data Definition, and select the desired data definition.
- Click Submit to save the Data Definition on the page. If necessary, click on the ‘Edit’ tab and enter content into the page using the Data Definition.
*Please note - with the availability of Content Types as of Cascade Server 5.5, it is recommended as a best practice that a Content Type is created using the appropriate Data Definition to then be applied to a page. Applying a Data Definition directly to a page is deprecated in favor of using Content Types.
Smarter Forms with Smart Fields
Smart Fields allow you to configure Data Definitions that dynamically reveal and hide fields or groups of fields depending on previously entered values. This can be useful for long forms where some fields are only needed if a particular field value is specified in a different field. One common example of this is a set of fields for contact information which should only be visible if the user has selected to include contact information on the page.
Fields or groups of fields can be hidden/shown based on the values of fields with pre-selected values -- checkboxes, dropdowns, radio buttons, and multi-selects.
Configuring Smart Fields
Smart Fields are configured by editing a specific field value for a checkbox, radiobutton, dropdown or multi-select field and selecting which fields or groups of fields should be exposed when that value is selected. For a particular field or group of fields, if any rules exist to show the field when another field's value is selected, then the field or group of fields will be hidden when viewing the form unless that value is specified.
To configure Smart Fields in the graphical Data Definition builder:
- Edit a checkbox, radiobutton, dropdown or multi-select field
- In the "Item" area for the field value that should reveal another field or group of fields, use the "Select a field..." picker next to "Show Fields" to select one or more fields to reveal.
To configure Smart Fields in the XML view,
- Add a "show-fields" attribute to the <item> containing the value that should reveal the other fields or groups or fields
- Enter a comma-separated list of field identifiers. For fields inside of groups, use a slash '/' to indicate the group nesting -- e.g. group1/inside-field
When editing a Data Definition with the graphical builder, all fields are always visible. There is text below fields affected by Smart Field rules explaining when these fields will appear.
When viewing a Data Definition itself, all fields are initially visible. Use the "Apply Smart Field rules"/"Show all fields" to toggle back and forth between previewing the form with and without the rules applied.
Smart Field Examples
A use-case that demonstrates a few different features of Smart Fields is a form with fields for an address including a "Country" dropdown and associated zip-code field.
When the Country "United States" is selected, a "5 digit zip code" field could be revealed whereas when "Canada" is selected, a "6 character postal code" field could be shown. If the "Country" field has no value selected, both "5 digit zip code" and "6 character postal code" fields could be hidden.
These rules can stack up as well. In the example above, we could have an "Include Address?" checkbox with the "Country" show-field selected. This would automatically cause the "Country" field, "5 digit zip code" and "6 character postal code" fields to be hidden by default when the "Show Address?" checkbox is unchecked, even if the "Country" field has a default value selected. This is because for the Smart Field rules, hidden fields count as if they had no value selected.
Groups of fields can also be progressively disclosed, which would result in the group being hidden by default unless a specific value is selected. In the example above, the "Country", "5 digit zip code" and "6 character postal code" fields could be inside of "Address" group. Then, the "Include Address?" checkbox could have the "Address" group selected as a show-field.
In-context Editing with Smart FieldsWhen editing a page in-context, only the selected in-context fields for a given region are included in show-field rules. Using the example above, if only the "Address" group is configured to appear for an in-context editing region and the "Show Address?" checkbox is not, the "Address" group will be always visible - i.e. the rule coming from the "Show Address?" checkbox will be ignored because the field is not selected for this region for in-context editing purposes.
Field Validation with Smart Fields
Fields that are marked as required or whose content is validated with regular expressions but are hidden due to Smart Field rules are not validated on submit. This allows you to create conditionally required and conditionally validated fields in Data Definitions.
Smart Fields and Rendered Structured Data
Smart Field rules do not affect the rendered structured data content that appears on pages or in index blocks. This is important when writing Formats because you can assume all fields will always be visible.
As a Format writer, you may also need to check the values of fields you're using to reveal other fields. For example, a field such as the "Country" dropdown mentioned above may have a value set but may not be shown due to the fact that "Include address?" is not checked. Before outputting the "Country" field in your Format, you need to check the value of "Include Address?" instead of just checking for the presence of a value for the Country field.
For information on Cross-Site relationships for Data Definitions, check out our Cross-Site relationship rules page.
Data Definition References
- Does Cascade Server offer Structured Authoring?
Cascade Server’s granular structure allows content types to be created and reused across multiple sites without compromising security. Predefined content types, called Data Definitions can be easily replicated across sites, using a different style for each.
Different departments, therefore, can post “news” to their own sites, each using the same structured format. These “news” items are automatically formatted in a style appropriate for that department.
Data Definitions can be edited to set certain fields as required. Required fields are marked with an asterisk (*). If a user attempts to edit a Data Definition-based asset without filling in the required fields, an error message is generated specifying which field data is missing.
Cascade Server comes with a number of useful Data Definitions ‘out-of-the-box.’ These are fully editable by an administrator, including which fields are required. In addition, administrators may specify required formatting for a field, such as ten digits in a ‘phone’ field. Data Definitions may also be configured to auto-format such fields to ensure consistency.