Knowledge Base

Conditional Elements

Last Modified:
20 Dec 2024
User Level:
Power User

Description

Conditional Elements allows Administrators and Power Users to customize the Content Editing Experience for their users by conditionally displaying elements based on specific criteria. This feature helps simplify and streamline the content creation process for users by showing only relevant fields to Content Editors.

How to Configure Conditional Elements

Accessing Conditional Logic

  • Navigate to the Content Type configuration (Assets » Content Types) and select a Content Type
  • Select the "Elements" tab
  • Click on the new "Conditional logic" button

The conditional logic button is located directly before the add elements buttons

This will open a slide-out window where you can create conditional statements and see a real-time preview

Real-Time Preview

When configuring Conditional Elements, you'll notice:

  • A live preview of a content item is automatically displayed
  • This preview updates in real-time as you add or modify conditional statements
  • Allows you to immediately see how your logic affects the editing interface

Changes to your conditional statements are reflected in the live preview in real time

Saving changes

Once you've created your conditional statements, ensure you save the Content Type before navigating away from the page.

Conditional Statement Types

There are three types of conditional statements. 

Content Element-Based Conditions, User Group Conditions, and User Type Conditions.

The first option when creating conditional elements will allow you to choose the condition type

1. Content Element-Based Conditions

  • Allows element(s) to be shown based on the content of a different element.
  • Useful for revealing additional elements based on specific input

Example 1: "If 'Research Type' is set to 'Grant-Funded', then show 'Funding Body Details' field"

Example 2: "If 'Course Level' dropdown is 'Postgraduate', then show 'Research Methodology' field"

Options depending on element type

Depending on the type of element you select, the options available for your conditional statements may be different.

The table below outlines all the different options depending on the element type selected.

Element Type Conditions Available Option Available (If applicable)
Plain Text
  • Is Empty
  • Is not Empty
  • Contains
  • Does not contain

If the Condition is set to "Contains" or "Does not contain":

User is shown a text input where they can type a string

HTML
  • Is Empty
  • Is not Empty
  • Contains
  • Does not contain

If the Condition is set to "Contains" or "Does not contain":

User is shown a text input where they can type a string

Date
  • Is Empty
  • Is not Empty

N/A

Decimal Number
  • Is Empty
  • Is not Empty

N/A

Whole Number
  • Is Empty
  • Is not Empty

N/A

Media
  • Is Empty
  • Is not Empty

N/A

File
  • Is Empty
  • Is not Empty

N/A

Image
  • Is Empty
  • Is not Empty

N/A

Select Box
  • Is Empty
  • Is not Empty
  • Contains
  • Does not contain

If the Condition is set to "Contains" or "Does not contain":

User is shown dropdown input where they can select a single value from the selected list

Check Box
  • Is Empty
  • Is not Empty
  • Contains
  • Does not contain

If the Condition is set to "Contains" or "Does not contain":

User is shown dropdown input where they can select a single value from the selected list

Radio Button
  • Is Empty
  • Is not Empty
  • Contains
  • Does not contain

If the Condition is set to "Contains" or "Does not contain":

User is shown dropdown input where they can select a single value from the selected list

Multi-select List
  • Is Empty
  • Is not Empty
  • Contains
  • Does not contain

If the Condition is set to "Contains" or "Does not contain":

User is shown dropdown input where they can select a single value from the selected list

Multiple Select
  • Is Empty
  • Is not Empty
  • Contains
  • Does not contain

If the Condition is set to "Contains" or "Does not contain":

User is shown dropdown input where they can select a single value from the selected list

Cascading List
  • Is Empty
  • Is not Empty
  • Contains
  • Does not contain

If the Condition is set to "Contains" or "Does not contain":

User is shown dropdown input where they can select a single value from the selected list

Keyword Selector
  • Is Empty
  • Is not Empty

N/A

Section/Content Link
  • Is Empty
  • Is not Empty

N/A

Content Owner
  • Is Empty
  • Is not Empty

N/A

Group Select
  • Is Empty
  • Is not Empty

N/A

2. User Group Conditions

Allows showing/hiding elements based on user group membership.

Example 1: "If User is in group 'International Admissions', then show 'Visa Requirements' elements"

Example 2: "If User is in group 'Research Grants Team', then show 'Indirect Cost Calculation' element"

3. User Type Conditions

  • Controls element visibility based on the user's permission level
  • Helps manage element access for different user types (Administrator, Power User, Moderator, Contributor)
  • Simplifies content creation UI for user types that may not need to see all elements

Example 1: "If User is at least 'Administrator', then show 'Advanced Options' element"

Example 2: "If User is at least 'Moderator', then show 'Background Image' element"

Important Considerations

Logic Rules

  • All conditional statements use OR logic
  • If ANY conditional statement indicates an element should be displayed, it will be shown
  • Note: Currently, AND logic is not supported
    • For example, it's not possible currently to create a rule like "If 'Element A' contains 'Test' AND 'Element B' contains 'Test' Then show 'Element C'.
    • Let us know if this is something you'd use and how you'd like to use it!

Scope of Functionality

Editing Experience Only

  • Conditional Elements ONLY affect how elements are displayed to Content Editors
  • This feature does NOT impact how content is output on published pages

Content Layouts may require separate configuration for output logic

Not a Security Feature

  • Conditional Elements is a quality of life improvement
  • Hidden elements can still potentially be accessed or edited

Do NOT rely on this feature for access control or security purposes

Power User Permissions

Power Users do have the ability to manage Content types for any groups they are a member of.

This means that Power Users can create and edit existing Conditional Statements.

Important Note User Group-Based Conditions

  • If an already existing Conditional Statement specifies an element should be shown only to users in a specific group
  • AND the Power User is NOT a member of that group
  • THEN the Power User will be prevented from:
    • Modifying that existing Conditional Statement
    • Removing that existing Conditional Statement
  • Power Users can safely modify other conditional statements and add new ones

Power Users may be prevented form editing or removing some group-based conditional statements

In the scenario that a Power User needs to remove or modify a Conditional Statement that they do not have access to, it is recommended that they

  • Consult an Admin to make the change for them OR
  • Request temporary access to the required group from an Admin

Required Fields

  • If an element is marked as "required" but it is hidden by a conditional statement, it is NOT considered required
  • "Required" now means "required if shown to content editors"

Saving Content with hidden fields

When saving content items, the data within hidden elements is NOT changed from how it was stored when the content is first loaded.

  • If a user edits a content item and a field is hidden, the data in that field isn’t removed when saving
  • If a user edits a content item and makes a change that results in a previously displayed element to become hidden, the value of the now hidden field remains unchanged when saving
  • If a user edits a content item and changes a value in "Field A" and then that user subsequently makes a change that results in "Field A" being hidden, when the content item is saved, the changes in "Field A" will not be saved

If adding conditional statements to existing Content Types it is advised that you consider whether logic is also required in your Content Layouts to ensure the expected data is output.

Debugging Conditional Elements

Show All Elements Option

When an Admin (or a Power User with the permissions to edit the Content Type) edits a content item with Conditional Elements:

  • A new "Show all elements" checkbox is available
  • When checked, ALL conditional logic is temporarily disabled
  • All elements are displayed, regardless of existing conditions

An option shown to admins to allow them to debug content items with conditional elements

This option is there to help administrators troubleshoot cases where elements are hidden and it's not clear why.

Practical Uses For Conditional Elements

Here are some examples to give you some ideas of how conditional elements could be used.

This is far from an exhaustive list, but should give you some ideas of what's possible.

  1. Course Catalog Content Type
    1. Show 'International Student Requirements' when 'Applicant' is not 'Local'
    2. Show 'Research Supervision Details' only when 'Program level' is Postgraduate
    3. Show 'Funding Opportunities' element to content editors in 'Financial Aid' group
  2. Research Content Type
    1. Show 'Collaborative Research' element only when 'Project Type' is 'Interdepartmental'
    2. Show 'Compliance Documentation' for research involving human subjects
    3. Show 'Budget Modification' field only for users in the 'Department Head' group
  3. Carousel Slider Content Type
    1. Show 'Background Image' element when 'Background Type' is 'Image'
    2. Show 'YouTube URL' element when 'Background Type' is 'Video'
  4. Call To Action Content Type
    1. Show 'Internal Link' element when 'Link Type' is 'Internal'
    2. Show 'External Link Text' and 'External Link URL' elements when 'Link Type' is 'External'

Best Practices

The purpose of conditional elements is to simplify the content editing experience for your users. Below are some best practices to consider if you decide to implement Conditional Elements in your Content Types.

  • Only hide elements when it genuinely improves the editing experience
  • Consider the overall user experience when applying conditions
  • Ensure that hidden elements do not create confusion for content editors
  • Avoid adding too many conditional statements to a single Content type
    • This is likely to result in a confusing Content Editor experience and may result in performance degradations
  • Utilize the real-time preview when configuring conditional logic
  • Ensure that content layouts also contain logic to output the appropriate elements if required
  • Admins can use the "Show all elements" option on content items when troubleshooting hidden fields
  • Carefully test conditional logic 
    • Be aware that conflicting conditional statements can create scenarios where elements are never displayed
    • Review all conditional statements to ensure they do not inadvertently prevent element visibility
    • Use the real-time preview to validate that elements can be shown under expected conditions
    • If in doubt, ask another administrator to review your conditional logic