CMS_INPUT_CHECKBOX
Contents |
for example |
to the methods: Set<Option> |
CMS_INPUT_CHECKBOX
The checkbox is a complex selection field. The editor cannot directly enter any contents here, but instead can only select the required contents from a pre-defined selection of entries.
Unlike the ComboBox (CMS_INPUT_COMBOBOX) and Radiobutton (CMS_INPUT_RADIOBUTTON) input components, with checkboxes it is possible to make more (or less) than one selection simultaneously. Any number of entries can be selected.
Analogous to this the List (CMS_INPUT_LIST) input component can also be used, which also offers a selection of as many (or no) entries from a list as you wish.
In addition, if used in the Content Store with the general CMS_INCLUDE_OPTIONS tag, database contents can be displayed in the input component.
Access-API example use case
The exemplary implementation CheckboxEditorValueExample shows some simple examples of use for the reading, writing and creating access to the data object (CheckboxEditorValue) and its inner data container (OptionModel) of the input component by means of the FirstSpirit Access-API.
- Example of use: CheckboxEditorValueExample
- Data object: CheckboxEditorValue
- Container type: OptionModel
Mandatory
Optional parameter
Optional parameter
Optional parameter
Optional parameter
Optional parameter
Optional parameter
Optional parameter
Optional parameter
Optional parameter
Optional parameter
Mandatory
Mandatory
Optional parameter
Optional parameter
Optional parameter
Mandatory
Optional parameter
Optional parameter
Parameter
The following table gives the parameters of the CHECKBOX input component.
name
The attribute "name" is the variable name of an input component with which the the result object of the input component can be used in the templates - with the help of $CMS_VALUE()$ - or the content can be output.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
name* | Yes | 3.1 | Designator | None |
allowEmpty
The "allowEmpty" parameter is used to specify whether a value has to be entered for an input value or not.
If allowEmpty="YES" input is not mandatory; however, it is if allowEmpty="NO".
Input components with allowEmpty="NO" are also called mandatory input components.
The default value for allowEmpty is YES.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
allowEmpty | No | 3.0 | YesNo | YES |
convertEntities
The "convertEntities" attribute is used to convert special characters entered in the input components for output in HTML characters.
There are three forms:
- convertEntities="NONE" (standard)
- convertEntities="STANDARD"
- convertEntities="QUOTE"
With the NONE form, no conversion rules whatsoever are applied.
If STANDARD is given the conversion rules in the "convert" area of the selected conversion rule of the presentation channel are applied.
The form QUOTE explicitly includes STANDARD too. However, the "quote" area of the conversion rule is also applied.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
convertEntities | No | 2.0 | ConvertEntity | NONE |
gridHeight
The "gridheight" parameter states how many options are to be displayed under each other in the display of the input component.
If a value is given for the "gridheight" parameter, this value takes priority over the value of the "gridwidth" parameter.
If the values of the "gridwidth" and "gridheight" parameters contradict each other the value of the "gridheight" parameter applies to display of the input component.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
gridHeight | No | 2.0 | PositiveInteger | None |
gridWidth
The "gridwidth" parameter states how many options are to be displayed next to each other in the display of the input component.
If no value is given for the "gridwidth" parameter the default value is "2".
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
gridWidth | No | 2.0 | PositiveInteger | 2 |
hFill
An input component is always displayed with a pre-defined width.
However, if the input component is to use the full available display width the parameter hFill must be given with the value YES .
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
hFill | No | 2.0 | YesNo | NO |
hidden
With the "hidden" parameter an input component can be hidden from the editor.
If hidden="YES" the input component is not visible for the editor, if hidden="NO" it is visible.
The default value for hidden is NO.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
hidden | No | 4.0.44 | YesNo | NO |
noBreak
The noBreak parameter can be used to suppress automatic line break after an input component.
The noBreak parameter must be given with value "YES" (noBreak="YES") to suppress the automatic line break.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
noBreak | No | 2.0 | YesNo | NO |
preset
Using the preset attribute the handling of default values in an input component can defined (see also chapter Default values). If preset="default" is set, the retrieval value defined in the form is used. If this value in the form is changed later on, these changes will be affect all usages of this default value in the input components maintained by the editor, as long as a value will be set manually in the input component. This is the default setting. If preset="copy" is set, the value entered by the editor is copied directly into the input component. Subsequent changes to the default value in the form do not have any effect on the usages of this default value in the input components maintained by the editor.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
preset | No | 4.0 | Preset | DEFAULT |
sortOrder
The sortOrder parameter can be used to influence the sort order of the entries in the input component.
Three key terms can be used for the parameter:
- sortOrder="KEEP_ORDER" (standard)
- sortOrder="ASCENDING"
- sortOrder="DESCENDING"
With KEEP_ORDER the given order of the entries is retained.
With the value ASCENDING the entries are alphabetically sorted in ascending order and with DESCENDING they are alphabetically sorted in descending order.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
sortOrder | No | 3.0 | SortOrder | KEEP_ORDER |
useLanguages
The useLanguages parameter can be used to specify whether or not an input component is to store different or deviating values for different languages (multi-lingual maintenance).
If the parameter is not given, deviating values are stored for the different languages as a default.
If NO (...useLanguages="NO") is specified, one value is stored for all languages.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
useLanguages | No | 2.0 | YesNo | YES |
ENTRIES
The ENTRIES tag can be used to specify the quantity of entries available for selection in the input component.
The ENTRY tag can be given in the tag.
A selectable entry corresponds to an ENTRY tag.
ENTRY
An ENTRY tag is used to precisely define a format template within the ENTRIES tag, which is to be available for selection in the input component. The tag has the mandatory parameter value, which corresponds to the value to be stored in the input component.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
value* | Yes | 2.0 | String | None |
value
The value parameter in the ENTRY tag is used to specify the value to be stored in the input component.
The individual values of the value parameters within an ENTRIES tag must be different from each other. |
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
value* | Yes | 2.0 | String | None |
LANGINFOS
Using the tag LANGINFOS language-dependent information can be defined for each input component, e.g. which title is to be used for the input component in the different project languages (parameter label), which tooltip is to be displayed (parameter description) etc. For reasons of clarity, definitions which are identical in multiple languages will be merged. For example,
<LANGINFOS>
<LANGINFO lang="*" label="Datum"/>
<LANGINFO lang="DE" label="Datum"/>
<LANGINFO lang="EN" label="Datum"/>
</LANGINFOS>
will be merged to
<LANGINFOS>
<LANGINFO lang="*" label="Datum"/>
</LANGINFOS>
after saving.
Up to and including FirstSpirit version 4.2R2 language definitions will be deleted only in the case if the values are identical in all languages (as in example above). Furthermore, only the parameters lang, description and label are taken into account when merging.
Since FirstSpirit version 4.2R4 all parameters are taken into account (e.g. format and length). Furthermore, language definitions are also merged within LANGINFOS tags, if they are identical in at least two languages. For example,
<LANGINFOS>
<LANGINFO lang="*" label="Date" format="dd.MM.yy"/>
<LANGINFO lang="DE" label="Date" format="dd.MM.yy"/>
<LANGINFO lang="EN" label="Date" format="MM/dd/yy"/>
</LANGINFOS>
will become
<LANGINFOS>
<LANGINFO lang="*" label="Date" format="dd.MM.yy"/>
<LANGINFO lang="EN" label="Date" format="MM/dd/yy"/>
</LANGINFOS>
after saving.
The definition for the fallback value (*) will not be deleted in any case. If there are two or more language definitions with identical values the first one will be maintained, the other will be deleted.
IMPORTANT: Up to and including FirstSpirit version 4.2R2 at least one definition for the fallback labelling ("*") must be given:
<LANGINFOS>
<LANGINFO lang="*" label="TEXT"/>
</LANGINFOS>
From FirstSpirit version 4.2R4 the fallback definition can be omitted. In this case, the language which is defined first will be used automatically as fallback value. For example,
<LANGINFOS>
<LANGINFO lang="EN" label="Date"/>
<LANGINFO lang="DE" label="Datum"/>
</LANGINFOS>
will become
<LANGINFOS>
<LANGINFO lang="*" label="Date"/>
<LANGINFO lang="DE" label="Datum"/>
</LANGINFOS>
after saving.
LANGINFO
The LANGINFO tag is used to give values or attributes for a language as well for use as fallback values.
In order to state values or attributes for a language it is necessary to give the abbreviation of the project language in the lang parameter:
...
<LANGINFO lang="DE".../>
...
Fallback values are given with the special language abbreviation * ("for all languages"):
...
<LANGINFO lang="*".../>
...
The lang parameter is a mandatory parameter.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
lang* | Yes | 3.1 | LanguageAbbreviation | None |
description | No | 3.1 | String | None |
ignore | No | 4.0 | YesNo | NO |
label | No | 3.1 | String | None |
lang
The lang parameter is used to give the language abbreviation which is entered in the server properties see FirstSpirit Manual for Administrators, Chapter "Language templates") to specify for which project languages the definitions are to apply, e.g. DE for German, EN for English, FR for French etc. The following characters can be used as often as required: -, _, 0-9 and A-Z. Lower case letters are transformed automatically into upper case letters after having saved the template. In addition * can be used for fallback values.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
lang* | Yes | 3.1 | LanguageAbbreviation | None |
description
The description parameter can be used to give a description which is used to display a tool tip (mouse-over).
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
description | No | 3.1 | String | None |
ignore
The ignore parameter can be used so that the entry is not displayed or is ignored in the given language.
If the parameter is not given an entry is displayed in the language.
If YES (...ignore="YES") is specified the corresponding entry in the given language is ignored.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
ignore | No | 4.0 | YesNo | NO |
label
The label parameter is used to give the surface labelling for input and visualisation components.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
label | No | 3.1 | String | None |
LANGINFOS
Using the tag LANGINFOS language-dependent information can be defined for each input component, e.g. which title is to be used for the input component in the different project languages (parameter label), which tooltip is to be displayed (parameter description) etc. For reasons of clarity, definitions which are identical in multiple languages will be merged. For example,
<LANGINFOS>
<LANGINFO lang="*" label="Datum"/>
<LANGINFO lang="DE" label="Datum"/>
<LANGINFO lang="EN" label="Datum"/>
</LANGINFOS>
will be merged to
<LANGINFOS>
<LANGINFO lang="*" label="Datum"/>
</LANGINFOS>
after saving.
Up to and including FirstSpirit version 4.2R2 language definitions will be deleted only in the case if the values are identical in all languages (as in example above). Furthermore, only the parameters lang, description and label are taken into account when merging.
Since FirstSpirit version 4.2R4 all parameters are taken into account (e.g. format and length). Furthermore, language definitions are also merged within LANGINFOS tags, if they are identical in at least two languages. For example,
<LANGINFOS>
<LANGINFO lang="*" label="Date" format="dd.MM.yy"/>
<LANGINFO lang="DE" label="Date" format="dd.MM.yy"/>
<LANGINFO lang="EN" label="Date" format="MM/dd/yy"/>
</LANGINFOS>
will become
<LANGINFOS>
<LANGINFO lang="*" label="Date" format="dd.MM.yy"/>
<LANGINFO lang="EN" label="Date" format="MM/dd/yy"/>
</LANGINFOS>
after saving.
The definition for the fallback value (*) will not be deleted in any case. If there are two or more language definitions with identical values the first one will be maintained, the other will be deleted.
IMPORTANT: Up to and including FirstSpirit version 4.2R2 at least one definition for the fallback labelling ("*") must be given:
<LANGINFOS>
<LANGINFO lang="*" label="TEXT"/>
</LANGINFOS>
From FirstSpirit version 4.2R4 the fallback definition can be omitted. In this case, the language which is defined first will be used automatically as fallback value. For example,
<LANGINFOS>
<LANGINFO lang="EN" label="Date"/>
<LANGINFO lang="DE" label="Datum"/>
</LANGINFOS>
will become
<LANGINFOS>
<LANGINFO lang="*" label="Date"/>
<LANGINFO lang="DE" label="Datum"/>
</LANGINFOS>
after saving.
LANGINFO
The LANGINFO tag is used to give values or attributes for a language as well for use as fallback values.
In order to state values or attributes for a language it is necessary to give the abbreviation of the project language in the lang parameter:
...
<LANGINFO lang="DE".../>
...
Fallback values are given with the special language abbreviation * ("for all languages"):
...
<LANGINFO lang="*".../>
...
The lang parameter is a mandatory parameter.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
lang* | Yes | 3.1 | LanguageAbbreviation | None |
description | No | 3.1 | String | None |
label | No | 3.1 | String | None |
lang
The lang parameter is used to give the language abbreviation which is entered in the server properties see FirstSpirit Manual for Administrators, Chapter "Language templates") to specify for which project languages the definitions are to apply, e.g. DE for German, EN for English, FR for French etc. The following characters can be used as often as required: -, _, 0-9 and A-Z. Lower case letters are transformed automatically into upper case letters after having saved the template. In addition * can be used for fallback values.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
lang* | Yes | 3.1 | LanguageAbbreviation | None |
description
The description parameter can be used to give a description which is used to display a tool tip (mouse-over).
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
description | No | 3.1 | String | None |
label
The label parameter is used to give the surface labelling for input and visualisation components.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
label | No | 3.1 | String | None |
Example
An example of the input component CHECKBOX:
<CMS_INPUT_CHECKBOX gridWidth="1" gridHeight="3" name="IDENTIFIER" useLanguages="YES">
<ENTRIES>
<ENTRY value="VALUE">
<LANGINFOS>
<LANGINFO lang="*" label="TEXT"/>
<LANGINFO lang="DE" label="TEXT"/>
<LANGINFO lang="EN" label="TEXT"/>
</LANGINFOS>
</ENTRY>
</ENTRIES>
<LANGINFOS>
<LANGINFO lang="*" label="TEXT" description="TEXT"/>
<LANGINFO lang="DE" label="TEXT" description="TEXT"/>
<LANGINFO lang="EN" label="TEXT" description="TEXT"/>
</LANGINFOS>
</CMS_INPUT_CHECKBOX>
An example of the filling of a "CMS_INPUT_CHECKBOX" input component with entries from an external table (Content Store):
<CMS_INPUT_CHECKBOX gridWidth="2" name="IDENTIFIER" useLanguages="NO">
<CMS_INCLUDE_OPTIONS type="database">
<LABELS>
<LABEL lang="*">#item.COLUMN</LABEL>
<LABEL lang="DE">#item.COLUMN_DE</LABEL>
<LABEL lang="EN">#item.COLUMN_EN</LABEL>
</LABELS>
<TABLE>TABLETEMPLATE</TABLE>
</CMS_INCLUDE_OPTIONS>
<LANGINFOS>
<LANGINFO lang="*" label="TEXT" description="TEXT"/>
<LANGINFO lang="DE" label="TEXT" description="TEXT"/>
<LANGINFO lang="EN" label="TEXT" description="TEXT"/>
</LANGINFOS>
</CMS_INPUT_CHECKBOX>
Example of use in the template syntax
The following example displays the selected values of a CHECKBOX input component as an HTML list.
Starting with the following configuration:
<CMS_INPUT_CHECKBOX name="checkbox">
<ENTRIES>
<ENTRY value="1st_value">
<LANGINFOS>
<LANGINFO lang="*" label="1st label"/>
<LANGINFO lang="DE" label="1. Wert"/>
</LANGINFOS>
</ENTRY>
<ENTRY value="2nd_value">
<LANGINFOS>
<LANGINFO lang="*" label="2nd label"/>
<LANGINFO lang="DE" label="2. Wert"/>
</LANGINFOS>
</ENTRY>
</ENTRIES>
<LANGINFOS>
<LANGINFO lang="*" label="Selection"/>
<LANGINFO lang="DE" label="Auswahl"/>
</LANGINFOS>
</CMS_INPUT_CHECKBOX>
the output with the call
$CMS_VALUE(checkbox)$
- if both options are activated - leads to the output:
[1st_value, 2nd_value]
As the input component returns a Set<Option > object the output of all activated options can be realised with a $CMS_FOR(...)$ instruction. The value of an Option can be output with the .getValue() method:
<ul>
$CMS_FOR(w, checkbox)$
<li>$CMS_VALUE(w.value)$</li>
$CMS_END_FOR$
</ul>
The result would then be the output:
<ul>
<li>1st_value</li>
<li>2nd_value</li>
</ul>