arrow-down
    1. Overview
    2. Core concepts
    3. Using docs
    4. Intro Videos
    5. Tutorials
    1. Intro
    2. GraphQL API
    3. Media API
    4. Extending the API
    5. Component API
    1. Content Studio
      1. Branches
    2. Layers
      1. Lifecycle
      2. Media
      3. Attachments
      4. X-data
        1. Page templates
        2. Fragments
      5. Variants
      6. Permissions
      7. Versions
    3. Sites
      1. Visual editor
    4. Publishing
    1. Introduction
      1. Controllers
      2. Globals
      3. Events
      4. HTTP Request
      5. HTTP Response
      6. Error handler
      7. Filters
      8. Templating
      9. Localization
      10. Websocket
      11. Tasks
      12. Main controller
      13. Java bridge
      1. Admin Lib
      2. Application Lib
      3. Auditlog Lib
      4. Authentication Lib
      5. Cluster Lib
      6. Common Lib
      7. Content Lib
      8. Context Lib
      9. Event Lib
      10. Export Lib
      11. Grid Lib
      12. I18N Lib
      13. IO Lib
      14. Mail Lib
      15. Node Lib
      16. Portal Lib
      17. Project Lib
      18. Repo Lib
      19. Scheduler Lib
      20. Schema Lib
      21. Tasks Lib
      22. Value Lib
      23. VHost Lib
      24. Websocket Lib
    2. Other Libraries
      1. CLI
      2. Sandboxes
      3. Code
      4. Building
      5. Configuration
      6. TypeScript
    3. Building APIs
      1. Mappings
      2. Components
      3. Processors
      4. Contributions
    4. Building Webapps
      1. ID providers
      2. Admin Apps
      3. Admin Widgets
    1. Architecture
      1. TODO
      1. Navigating
      2. Users
      3. Applications
      4. Data management
      5. System info
      6. Audit Logs
      7. Task management
      1. Portal
      2. IDprovider
      3. Management
      4. Statistics
      1. Nodes and repos
      2. Properties
      3. Indexing
      4. Branches
      5. Editors
      1. DSL Queries
      2. NoQL Queries
      3. Filters
      4. Aggregations
      5. Highlighting
      1. ID providers
      2. System ID provider
      3. Users and groups
      4. Roles
      1. Strategies
      2. Distributions
      3. Docker
      4. Kubernetes
      5. Systemd
      6. Vhosts
      7. Configuration
      8. Backup & restore
      9. Clustering
      10. Observability
      1. Notes
      2. Upgrade
      3. Upgrading Apps
        1. Asset service
        2. HTTP service
        3. Image service
    1. Best practice
        1. AttachmentUploader
        2. Checkbox
        3. Combobox
        4. ContentSelector
        5. ContentTypeFilter
        6. CustomSelector
        7. Date
        8. DateTime
        9. Double
        10. GeoPoint
        11. HtmlArea
        12. ImageSelector
        13. Long
        14. MediaSelector
        15. Radiobutton
        16. Tag
        17. TextArea
        18. TextLine
        19. Time
        1. Field set
        2. Item set
        3. Option set
      1. Mixins
      2. Localization
      3. Styles
    2. Content Types
    3. X-data
    4. Macros
      1. Pages
      2. Regions
      3. Part component
      4. Layout component
      5. Text component
      6. Component Filtering
      7. Component Indexing
    1. Marketplace
    2. Market guidelines

Option Set

Contents

An option set is a group of options presented either as a multi-select option set (radio button style), or as a single-select option set (dropdown style).

Each option may contain an optional form, which also support nested item-sets and option-sets.

Single select mode

Appearance

In single select mode, an optionset will look similar to an item set, but you will rather have multiple "items" to select from.

Inserting a new optionset (visualized as a card). Available options are listed in a dropdown

When inserting a new optionset, the selected option’s form will automatically be expanded.

The example below what it looks like when multiple option set instances are inserted and expanded. Each option set is visualized as a card.

Notice that the Horizontal line option does not have a form.
Showing three expanded cards
Delete, reset or move the option panels using the right hand context menu.

The final example demonstrates the same form as above, with all forms collapsed.

Showing three cards with titles for the respective options used Quote
Easily shuffle the order of the option sets by dragging the cards from the grip zone on the left hand side.

Usage

The schema below demonstrates how you may create blocks of structured content using the single-select mode.

Sample 1: single-select setup with the options hr, text, gallery and quote.
<option-set name="blockOptionSet">
  <label>Content blocks</label>
  <occurrences minimum="0" maximum="0"/>  (1)
  <help-text>Create content with optional blocks</help-text>
  <options minimum="1" maximum="1">   (2)
    <option name="hr">  (3)
      <label>Horisontal line</label>
      <help-text>Adds a separator between blocks</help-text>
    </option>
    <option name="text">
      <label>Text</label>
      <items>
        <input name="text" type="TextArea">
          <label>Text</label>
          <occurrences minimum="1" maximum="1"/>
        </input>
      </items>
    </option>
    <option name="gallery">
      <label>Image gallery</label>
      <items>
        <input name="images" type="ImageSelector">
          <label>Images</label>
          <occurrences minimum="1" maximum="0"/>
          <config/>
        </input>
      </items>
    </option>
    <option name="quote">
      <label>Quote</label>
      <items>
        <input name="quote" type="TextLine">
          <label>Quote</label>
          <occurrences minimum="1" maximum="1"/>
        </input>
        <input name="quotee" type="TextLine">
          <label>Quotee</label>
          <occurrences minimum="1" maximum="1"/>
        </input>
      </items>
    </option>
  </options>
</option-set>
1 occurences Set value to maximum=0 for unlimited option-set (block) instances
2 options/@maximum Refers to selectable options per instance. A value of 1 ⇒ single-select mode.
3 option (required) Container of options. Each option may be empty or contain items, just like an item set.

Output

An example output of the above form, where the user has created three instances, using three different options: quote, hr and text.

Example output of single-select setup, here with three occurences.
{
  "blockOptionSet": [
    {
      "quote": {
        "quote": "Hi there",
        "quotee": "Mr Enonic"
      },
      "_selected": "quote"
    },
    {
      "hr": {
      },
      "_selected": "hr"
    },
    {
      "text": {
        "text": "A short text"
      },
      "_selected": "text"
    }
  ]
}
The _selected property can be used when searching for selected options for instance.

Multi select mode

Appearance

In multi select mode, the user may select zero to many options within a single option set.

Each option’s form (if it exists) will normally only be visible once the option is selected.

For convenience, a multi-select option set can be configured to have all options expanded by default.

Below: A multi-select option set where all options are expanded by default. Option 2 and 3 do not have any additional form items:

Form showing four options
For multi-select options sets, it is also possible to pre-select options by default.

Usage

The example below demostrates multi-select mode, with the options Coloring, Wood upgrade, Include curtains and Exclusive wallpaper. Only options 1 and 4 contain form elements. Also, user may maximally select two options.

Multi-select option set with the coloring option selected by default.
<option-set name="styling">
  <label>Room styling</label>
  <expanded>true</expanded> (1)
  <occurrences minimum="1" maximum="1"/> (2)
  <help-text>Select up to 2 options</help-text>
  <options minimum="1" maximum="2"> (3) (4)
    <option name="coloring"> (5)
      <label>Coloring</label>
      <help-text>Select a color palette for the room</help-text>
      <default>true</default> (6)
      <items>
      <input name="palette" type="ComboBox">
        <label>Palette</label>
        <occurrences minimum="1" maximum="1"/>
        <config>
          <option value="spring">Spring</option>
          <option value="summer">Summer</option>
          <option value="autumn">Autumn</option>
          <option value="winter">Winter</option>
        </config>
        <default>spring</default>
      </input>
      </items>
    </option>
    <option name="wood">
      <label>Wood upgrade</label>
      <help-text>Wooden floor and doors</help-text>
    </option>
    <option name="curtains">
      <label>Include curtains</label>
      <help-text>Adds curtains to all windows</help-text>
    </option>
    <option name="wallpaper">
      <label>Exclusive wallpaper</label>
      <items>
        <input name="product" type="ContentSelector">
          <label>Wallpaper</label>
          <occurrences minimum="1" maximum="1"/>
          <config/>
        </input>
      </items>
    </option>
  </options>
</option-set>
1 expanded Set to true to expand all of the options by default
2 occurrences Allow zero, one or more instances of the whole option-set.
3 options/@minimum (required) Minimum number of options that must be selected in this option set.
4 options/@maximum (required) Maximum number of options to create. > 1 ⇒ multi-select mode. 1 ⇒ single-select mode.
5 option/@name (required) Must be unique within the option set.
6 default Set to true to pre-select one of the options.

Output

The output from the example above may look like this:

Example output from multi-select form, with a single occurence.
{
  "styling": {
    "_selected": [
      "coloring",
      "wood"
    ],
    "coloring": {
      "palette": "spring"
    },
    "wood": {
    }
  }
}
The _selected property contains information about which options were selected.

Contents

Contents

AI-powered search

Juke AI