Magnolia 4.5 reached end of life on June 30, 2016. This branch is no longer supported, see End-of-life policy.
A control is an HTML form element that allows the user to perform a task such as enter text, upload an image or select a date. Controls are assembled into tabs and tabs into dialogs . Magnolia is delivered with a number of controls which should fulfill most needs. It is also possible to create custom controls .
These properties apply to all control types.
Property | Description | Default value |
---|---|---|
| Type of control. Mandatory. This determines which control is rendered. Value can be a type or a class name. For instance, the control type | Class name if no control type is specified. |
| Name assigned to the control. Optional. Determines the name of the data node where the value entered by the user is stored. If no name is specified, the name of the control's content node is used instead to store the field value. Avoid special characters. | Name of the control node. |
| Makes the field mandatory. Indicated by an asterisk next to the label. Simple validation is applied to the control when this property is set to |
|
| Regular expression pattern used to validate the field value. |
|
| Defines the data type of the stored value. Possible types are | Most controls set a default value automatically. An exception is the |
| Pre-filled value displayed in the field. The value can be overwritten by the user. Available for all controls except multiselect in Magnolia 4.5.10 and earlier. |
|
| Text displayed as field label. Typically retrieved from a message bundle . |
|
| Text displayed below the label providing additional information. |
|
| Text displayed below the input field. Can be used to explain the purpose the control or to provide value examples. |
|
| Draws a line above the control. |
|
| Draws a line above the input area of a two-column control only, not over the label. |
|
| Message bundle for localized field labels. This property is set at the dialog level , not for individual controls. | Value provided in the dialog definition is used as a default. |
| Enables i18n authoring support. This allows authors to write foreign language or regionally targeted content. A two-letter language identifier (en, ge, fr etc.) is displayed on controls where i18n is set to | In STK controls this property is typically set to |
| Determines the number of columns used. Possible values are |
|
| A session attribute. Add a value here if you want to associate it with the session. |
|
| Defines whether field data should be saved. The dialog saveHandler performs the save operation. |
|
| Displays the field in a column in AdminCentral when set to |
|
Tab is a control that lets you organize a dialog into a tabs. All other controls are located inside a tab control.
You need at least one tab into your dialog. Controls cannot be added to a tabless dialog.
Control type: tab
Property | Description | Default |
---|---|---|
| Label displayed to the user. This is the text on the tab. Typically retrieved from a message bundle . |
|
API: DialogTab
The edit
control renders an editable text field that allows for single or multiple rows of text.
Control type: edit
Property | Description | Default |
---|---|---|
| Javascript that commits a change in the field value. |
|
| Number of text rows. |
|
| Width of the input field. Values can be in percentages (100%) or pixels (150px) |
|
API: DialogEdit
Source code editing control that provides real-time syntax highlighting and line numbers. Under the hood, it uses the CodeMirror (since Magnolia 4.4.2 it replaces CodePress) JavaScript library.
Control type: editCode
Property | Description | Default |
---|---|---|
| Enables syntax highlighting. When disabled, falls back to a plain textarea with a fixed-width font. In that case the |
|
| Enables syntax highlighting for a specific programmming language. Supported languages supported are |
|
| Makes the editor read-only. |
|
| Displays line numbers. |
|
| Determines the number of rows initially shown. | 20 |
KNOWN ISSUE: setting the control's width with the cols
option currently does not work.
API: DialogEditCode
fckEditor is a configurable rich text editor which allows users to format text, insert links, tables and images. It has functions similar to word processing applications. See also How to configure fckEditor.
Control type: fckEdit
Encourage editors to use Paste as plain text as opposed to Paste from Word to avoid potential CSS issues. The latter occasionally wraps the text in <div>
elements causing font size reduction. Alternatively, you can set FCKConfig.ForcePasteAsPlainText = true
in magnoliaStandard.js, but this will also disable the button.
Property | Description | Default |
---|---|---|
| Displays a font dropdown. Value is a list of font names separated by a semicolon. |
|
| Displays a font size dropdown. Value is a list of sizes separated by a semicolon |
|
| Enables the alignment buttons (left, center, right) when set to true. |
|
| Enables the font color palette. To disable the button, delete the property. |
|
| Cascading style sheet (CSS) applied to the edited text. The standard Magnolia CSS is used as a default. Other CSS locations can be specified. |
|
| Enables the styles dropdown. Value is a URI reference to an fckEditor style XML file. Styles displayed in the dropdown are defined in the XML file. See Styles in FCKEditor documentation. |
|
| Enables the templates dropdown. A template is a piece of HTML that is placed inside the editor, in this way the user doesn't need to start writing it from scratch. See Templates in FCKEditor documentation. |
|
| Height of the control in pixels. |
|
| Width of the control in pixels. |
|
| Enables the image feature that allows users to insert images and Flash files in the text. |
|
| Enables a table editor. |
|
| Enables the source code button which allows the user to edit the HTML source of the text. |
|
| Enables bulleted and numbered lists. This property is used by other properties such as |
|
| Enables a file upload control. |
|
| Enables a spellchecker. Spell checking is disabled by default. You can choose from a number of third party services to do the checking:
|
|
| Show the spellchecker button. |
|
| Custom JavaScript configuration file used by FCKEditor. Value is a path to the .js file. The value is used to set FCKEditor's |
|
| Code for initializing the fckEdit control. Alternatively, JavaScript object |
|
API: FckEditorDialog
The file
control allows the user to browse to and upload a digital file. This control is not used very often as the dam
control also offers the same functionality and more.
In the Data module , use the dataFile
control instead of the file
control.
Control type: file
Property | Description | Default |
---|---|---|
| Data type the value is stored as. You must set this to |
|
| Template to use to render the stored binary code. Since the file control is not frequently used, the nodeDataTemplate property is also used infrequently. |
|
| Width of the text field where the file name is displayed. | 100% |
| Controls whether a thumbnail preview of the saved digital file is displayed in the dialog. Preview rendering is supported for |
|
| Hides the Remove file button, filename and extension to prevent editing. |
|
API: DialogFile
The dam
control allows a user to upload files or browse for a file stored in the DMS. It is commonly used as an image picker but can be used to locate Flash and videos.
The control is configured in the Standard Templating Kit module in /modules/standard-templating-kit/controls
.
Control type: dam
The dam
control relies on damHandlers
which are configured in the Extended Templating Kit module at /modules/extended-templating-kit/config/sites/default/damSupport/handlers
. Handlers for file upload and selecting from the DMS are provided by default.
The link
control allows you to create a link to content stored in Magnolia. You can browse any specified repository and select a content node to link to such as a page (website
), file (dms
) or data item (data
).
The link
control differs from the uuidLink
control in that the former stores a path and the latter the universal unique identifier (UUID) of the target content node.
Control type: link
Property | Description | Default |
---|---|---|
| Repository to browse such as website, dms or data. |
|
| Optional file extension that is added to the link. |
|
| Tree to browse. This property allows you to set a starting point for the browsing. The value needs to be the name of the tree configuration. See wiki for instructions on how to open a specific path in a repository. In the | Name of the repository. |
| Name of the JavaScript function executed to activate the browsing function. Typically left empty for Magnolia standard tree browsing. This can be customized for specific functionality. |
|
| Width of the input field. Values can be percentages (100%) or pixels (150px). |
|
API: DialogLink
The uuidLink
control is identical in all respects to the link
control except that the link value is stored as a UUID of the target content node as opposed to a path. Links stored as UUIDs remain valid even if the target is moved. All properties applicable to the link
control are equally applicable here.
Control type: uuidLink
Property | Description | Default |
---|---|---|
| Repository to browse such as website, dms or data. |
|
| Optional file extension that is added to the link. |
|
| Tree to browse. This property allows you to set a starting point for the browsing. The value needs to be the name of the tree configuration. See wiki for instructions on how to open a specific path in a repository. In the | Name of the repository. |
| Name of the JavaScript function executed to activate the browsing function. Typically left empty for Magnolia standard tree browsing. This can be customized for specific functionality. |
|
| Width of the input field. Values can be percentages (100%) or pixels (150px). |
|
API: DialogUUIDLink
The date control allows a date and time to be selected. In order for the date control to work, the type
must be set to Date
so that the value will be saved as a Calendar object instead of a String.
Control type: date
Type: Date
Property | Description | Default |
---|---|---|
| Enables time selection in addition to date. |
|
| Date format adhering to SimpleDateFormat patterns. |
|
| Time format adhering to SimpleDateFormat patterns. |
|
| Date format using the DHTML calendar widget's date format syntax. | %Y-%m-%d |
| Time format using the DHTML calendar widget's time format syntax. |
|
Always set the properties as a pair: if you set jsTimeFormat
set also jsDateFormat
, not dateFormat
.
API: DialogDate
radio
, select
and checkbox
controls are configured very similarly. The difference between these three controls is the controlType
.
The individual options are child content nodes of an options
content node.
Control type: radio
, checkbox
or select
Property | Description | Default |
---|---|---|
| CSS class to use for the control. Can be changed from the default to a custom CSS. |
|
| Determines the number of columns the options are arranged in. Not applicable to the select control.1 for one column, 2 for two columns. |
|
| Reads a label from an alternate |
|
| The options property is a content node which contains the selectable options subnodes. |
|
| Value is stored internally in the JCR. The |
|
| Name of the node that stores the selected value. If this property is not set, the name of the option content node is used instead. |
|
| Sets the option as pre-selected. Setting this to true will select the radio button or dropdown option by default. (Note: Not implemented for checkbox) |
|
| The human-readable label for this option. |
|
| Displays an image next to the option. Value is a path to the image. |
|
| Instead of defining the options in the control you can reference an existing option set. This property identifies a path to the substitute configuration nodes. |
|
| When using |
|
| Read option values from a different data node. Set this property to the name of your custom value node. |
|
| Read option labels from a different data node. Set this property to the name of your custom label node. |
|
API: DialogSelect
The checkboxSwitch
control provides a simpler alternative to the checkbox
control when only a single checkbox or option is appropriate.
Control type: checkboxSwitch
Property | Description | Default |
---|---|---|
| Determines whether checkbox is selected on opening. |
|
| Allows you to include a label next to the checkbox. |
|
API: DialogButtonSet
The multiselect
control allows the user to select multiple values in a single field. Depending on the configuration, it can be used to store multiple text entries or multiple internal links. In the latter case, the user can browse for the link target using the repository explorer.
This control is commonly used in Magnolia security to assign multiple roles and groups to a user.
Control type: multiselect
Property | Description | Default |
---|---|---|
| JavaScript executed when a button is clicked. If no JavaScript is assigned to this property, no button is rendered. | Standard repository browser |
| Defines the tree to be browsed. Inclusion of this property activates the browsing feature |
|
| Specifies the structure the data will be saved in. Possible values are:
|
|
Magnolia 4.5.10+. The
defaultValue
property that is common to all dialogs is also available for the multiselect
control and supports a single defaultValue
.
In the Data module, the dataMultiSelect
control should be used instead of multiselect
. The Data module offers also a dataUUIDMultiSelect
control stores values as UUIDs.
API: DialogMultiSelect
The button
control renders an HTML button in the dialog.
Control type: button
Property | Description | Default |
---|---|---|
| JavaScript executed when the button is clicked. |
|
| Label displayed to the user. This is the text on the button. |
|
| By default a large button is rendered. The size can be reduced by setting this property to |
|
API: DialogButton
The static control renders non-editable text that displays a value next to the label.
Control type: static
Property | Description | Default |
---|---|---|
| Text displayed next to the label control. |
|
API: DialogStatic
The hidden
control defines a hidden field. No field is rendered in the dialog and the control itself does not have any properties of its own. The only relevant generic property is defaultValue
.
Hidden fields can be useful on forms to collect variables that are not filled in by the user, for example a session ID, language preference or IP address. Even though the field is not rendered or available to the user, the data collected is stored in the repository and can be viewed in the JCR Browser.
The hidden field is used in STK for example in the stkTeaserPureLinkList
component which renders a list of text links. Unlike most teasers, the component does not render a teaser image. A hidden control is used to set the hideTeaserImage
property to true
.
Control type: hidden
Property | Description | Default |
---|---|---|
| Specifies a default value. |
|
API: DialogHidden
The password
control renders two text input boxes designed for entry and verification of passwords. For security purposes, the input text is disguised with asterisks and the plain text password is saved using Base-64 encoding.
API: DialogPassword
Control type: password
Property | Description | Default |
---|---|---|
| JavaScript to execute when value is changed. |
|
| Verifies that the contents of the two boxes match. When set to false the verification box is not rendered. |
|
| Width of the input field. Values can be in percentages (100%) or pixels (150px). |
|
The passwordHash
control renders the same password box as the password
control but is more secure. The control stores cryptographic Bcrypt hash of the password rather than the password itself. Since the website does not know the password it cannot send it to the user in email if the user forgets their password. The website can only send the user a reset password link. If you use the passwordHash control for public user registration then you should set up a password retrieval strategy that sends a reset link.
API: DialogPasswordHash
Control type: passwordHash
Amend
Property | Description | Default |
---|---|---|
| JavaScript to execute when value is changed. |
|
| Verifies that the contents of the two boxes match. When set to false the verification box is not rendered. |
|
| Width of the input field. Values can be in percentages (100%) or pixels (150px). |
|
The include
control allows a JSP or other URI to be called and rendered in the dialog. The use of this control is described in wiki article Creating a custom control with DialogInclude.
API: DialogInclude
Control type: include
Property | Default | Description |
---|---|---|
| The default for this control property is blank or empty. | This property allows the URI for the include property to be specified. Normally this is a .jsp file. |
The freemarker
control renders a Freemarker script. You can use it to render HTML controls that Magnolia does not provide out of the box.
Control type: freemarker
API: DialogFreemarker
Property | Default | Description |
---|---|---|
|
| Path to the Freemarker script. |
| false | Store a single value or multiple values. Depends on the type of HTML control you are rendering. |
The control passes parameters to the Freemarker script. For example, the value
parameter is useful for setting the field to the value that was provided previously.
Parameter | Description |
---|---|
| A single field value entered by the user if |
| Multiple field values entered by the user if |
request | Current HTTPServletRequest. |
configuration | A complex dialog configuration is provided to the script as a map. |
Here is an example of how the configuration
parameter works. This dialog configuration:
+ myDialog + contentNode1 - property1 = value1 - property2 = value2 + contentNode2 - property3 = value3 - property4 = value4
Would be provided to the script as a map like this.
configuration = Map { "contentNode1" = Map { "property1" = "value1", "property2" = "value2", "contentNode2" = Map { "property3" = "value3" } }, "property4" = "value4" }
Here is a Freemarker script that renders an HTML5 color input control.
<input type="color" name="favoriteColor" id="favoriteColor" value="${value}">
With an extends
property you can point to a source configuration and inherit dialog configuration from the source. This can save some time and effort as you only need to define additions and exceptions explicitly. Extending is a mechanism used widely in site definitions.
Note In STK dialogs you may also see a
reference
property used to do the same thing. This property is now deprecated. Please use extends
instead.
To extend a configuration, add an extends
property to the relevant element in your configuration and set its value to the absolute path to the source configuration.
The example below extends the stkTextImage
dialog by adding an image tab to it. The image tab is inherited through extension from the generic tab configured at /modules/standard-templating-kit/dialogs/generic/controls/tabImage
.
Setting the value of the extends
property to override
allows the extending node to completely remove the inherited configuration. The stkPromo
component uses this feature. It inherits its configuration from the stkTeaser
component but an override under the areas
node prevents the linkList
area from being inherited.
Learn more about overrides.
Templating Samples module includes examples of many controls. The module .jar file is in the add-ons
folder under your Magnolia installation. You can also download it from the Magnolia Store. Follow standard module installation instructions.
After installation you can find a dialog definition in /modules/samples/dialogs/controlsShowRoom
.
To see the rendered dialog, open any of the samples pages in Website workspace and add the Controls sample component on the page.