CMS_INPUT_NUMBER
Contents |
for example |
to the methods: Number |
CMS_INPUT_NUMBER
This input component is used to input numerical values, whereby the template developer can specify both the values range (e.g. using the parameters max and min) and the type of numbers that can be entered (integer, decimal number, ... using the parameter type) as well as any display format for the numbers (using the parameter format).
Depending on the configuration and the language, only figures, a decimal separator (e.g. period if English is chosen as client language), a leading minus and the exponent character E can be input into this input component. Grouping separators (e.g. comma if if English is chosen as client language), round brackets, space characters etc. are not allowed. See also parameter format. |
Access-API example use case
The exemplary implementation NumberEditorValueExample shows some simple examples of use for the reading, writing and creating access to the data object (NumberEditorValue) and its inner data container (java.lang.Number) of the input component by means of the FirstSpirit Access-API.
- Example of use: NumberEditorValueExample
- Data object: NumberEditorValue
- Container type: java.lang.Number
Mandatory
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Optional parameters
Mandatory
Optional parameters
Optional parameters
Optional parameters
Parameter
The following table gives the parameters of the NUMBER 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 |
editable
The editable parameter can be used to specify whether editing of an input component is allowed or not.
Editing of the input component is possible if the parameter is omitted.
If NO (...editable="NO"...) is specified, editing of the input component is not possible.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
editable | No | 3.1 | YesNo | YES |
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 |
length
The length parameter can be used to specify the width of the input component.
The parameter expects an integer value.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
length | No | 2.0 | PositiveInteger | None |
max
Using the parameter max the maximum value which can be entered into the input component can be defined.
As a default, any numerical value can be entered into the input component. If a value was specified with max an according note will appear if a numerical value is to be saved in the input component which is higher than the value specified by the max parameter.
The parameter expects a decimal number in the format "Double". A point must be used as decimal separator, e.g. "3.5". If an integer is given, it will be completed automatically by ".0" when the template is saved.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
max | No | 3.0 | Double | None |
min
Using the parameter min the minimal value which can be entered into the input component can be defined.
As a default, any numerical value can be entered into the input component. If a value was specified with min an according note will appear if a numerical value is to be saved in the input component which is smaller than the value specified by the max parameter.
The parameter expects a decimal number in the format "Double". A point must be used as decimal separator, e.g. "3.5". If an integer is given, it will be completed automatically by ".0" when the template is saved.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
min | No | 3.0 | Double | None |
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 fall-back 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 |
singleLine
The singleLine parameter can be used to specify whether an input component is to be displayed in one row (without frame) or not.
If the parameter is not given the input component is displayed in one row - without a frame.
If NO (...singleLine="NO"...) is specified the input component is displayed over two rows with a frame.
To ensure uniform layout of the input components it is advisable to enter the following for the input components which support this attribute (e.g. COMBOBOX, DATE, NUMBER, TEXT and TOGGLE) singleLine="NO".
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
singleLine | No | 4.0 | YesNo | YES |
type
Using the parameter type you can define the type of number which is to be used for displaying and storing numbers in the input component CMS_INPUT_NUMBER.
Two types are available:
- LONG: Numbers are processed in the long integer format. They are integers between -263 and 263-1. They can take a memory capacity up to 8 bytes (see java.lang.Long). Example: ...type="LONG"...
- DOUBLE: Numbers are processed in the double format. They are floating-point numbers between 2-1074 and (2-2-52) * 21023. They can take a memory capacity up to 8 bytes (see java.lang.Double). Example: ...type="DOUBLE"...
The default setting for type is LONG. I.e. that only integers are allowed in the input component by default.
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
type | No | 3.0 | NumberType | LONG |
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 |
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 |
format | No | 3.0 | 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 , 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 |
format
Using the parameter format you can define how numbers are to be displayed in the input component. Here, country-specific particularities are taken into account.
For this purpose a formatting pattern can be specified. This is a model for defining e.g. if and which symbols are used as decimal separator (comma or dot) and how many decimal places are to be output etc. After having left the editing mode the numbers entered by the editor are adapted – if necessary – to the format requested by the formatting pattern. However, the value of the number will never be changed.
The following symbols can be used for the formatting pattern:
- 0
Wildcard for digits. The number of nulls will have an impact on if empty places are filled with zeros or on how many digits can be entered after the decimal separator.
- Case 1: If 0 is used in a formatting pattern without dots or before a dot (see below), the number of nulls will have an effect on the editor's input if the number of nulls of the formatting pattern is greater than the places of the editor's number: the places which are wmpty in the editor's input, will be filled with zeros.
Example: Using the formatting pattern "00" a "3" which is input in the component, will be "03" after saving. - Case 2: If 0 is used in a formatting pattern after a dot only, the editor can enter only as many decimal places as the formatting pattern nulls comprises. Decimal places which are requested by the formatting pattern but not given by the editor will be filled with zeros.
Examples: Using the formatting pattern "0.00" only two decimal places can be entered in the component. If only one decimal place is entered a null will be added: "012,3" will become "12,30" after saving.
- Case 1: If 0 is used in a formatting pattern without dots or before a dot (see below), the number of nulls will have an effect on the editor's input if the number of nulls of the formatting pattern is greater than the places of the editor's number: the places which are wmpty in the editor's input, will be filled with zeros.
- #
Wildcard for digits. If the place is empty in the editor's input it will stay empty after saving. By this means, leading zeros and zeros after commas will be deleted. If # is used after a dot (see below) the editor can enter only as many decimal places as # are defined by the formatting pattern.
Examples: Using the formatting pattern "#.#" the editor can enter only one decimal place. "012,3" will become "12,3" after saving. - . (dot)
Decimal separator, separates integer and decimal places. It will be only respected if type="DOUBLE" (see parameter type above) is set.
Only one decimal separator may be used in a formatting pattern. If no decimal separator is defined no decimal number can be entered into the component. The decimal separator must be entered depending on the language, selected on the FirstSpirit home page ("Locale"), e.g. , (comma) if German is used as language and . (dot) if English is selected.
Example: see examples for 0 and # - , (comma)
Grouping separator. For reasons of readability of big numbers the digits of the number can for example be united into triples starting from the lowest places by using the symbol ,. If more than one is defined , in one formatting pattern only the last will be interpreted. The grouping separator must entered depending on the language, selected on the FirstSpirit home page ("Locale"), e.g. . (dot) if German is used as language and , (comma) if English is selected. It can also be combined with the dot (see above).
Example: Using the formatting pattern ",000.00", "12345678,9" will become "12.345.678,90" after saving. - E (exponent sign)
The number will be displayed in exponent notation.
Example: Using the formatting pattern "##E0", "1234567890" will become "12E8" after saving.
Formattings are displayed in the input component depending on the selected language. |
If using several symbols please pay attention that they do not conflict. If an invalid formatting pattern is defined, the template can not be saved and a notification will be displayed. |
For outputting national currency symbols, per cent and per mille signs and individual text the method format (data type Number) can be used. |
Parameter | Mandatory | Since | Type | Default value |
---|---|---|---|---|
format | No | 3.0 | 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 "CMS_INPUT_NUMBER":
<CMS_INPUT_NUMBER useLanguages="YES" name="IDENTIFIER">
<LANGINFOS>
<LANGINFO lang="*" label="TEXT" description="TEXT"/>
<LANGINFO lang="DE" label="TEXT" description="TEXT"/>
<LANGINFO lang="EN" label="TEXT" description="TEXT"/>
</LANGINFOS>
</CMS_INPUT_NUMBER>
For the output of the NUMBER a simple $CMS_VALUE(...)$ instruction can be used, or the template developer uses a $CMS_IF(...)$ to query the value of the form of a NUMBER.
$CMS_IF(st_number > 0)$
$CMS_VALUE(st_number)$ * 4 = $CMS_VALUE(st_number * 4)$<br>
$CMS_END_IF$
The output is then as follows.
223 * 4 = 892<br>
Further topics |
---|
$CMS_IF(...)$ instruction, $CMS_VALUE(...)$ instruction |