Element building blocks - kwantu/platformconfiguration GitHub Wiki
This page was originally the 6. Element building blocks part of the Data object component page and was moved here on 2018-01-07 because that page had become too unwieldy.
Each element from the following list, (elfield, elSelect, elUpload and elRepeat), contains (or is made up of) reusable blocks called "element blocks", to coin a phrase.  These "element blocks" are described in the following paragraphs: (6.1 displays, 6.2 data, 6.3 fieldData, 6.4 validations, 6.5 help )
A vital concept to understand is the link between a specific uiLayout and a user interface display. This link is implemented by making the value of the .displays.display.mode attribute identical to the relevant .uiLayouts.uiLayout.id to which it links. (note: The mode attribute is poorly named. It should actually be called uiLayoutId, because that is what its value refers to. [2018-01-03]) 
The following code snippet shows the structure of the display element block:
Example code 6
<displays>
    <display show="true" mode="edit" widget="combobox">
        <label show="true">
            <i18n xml:lang="en">To what extent do you feel you have  influence over solutions to issues identified in your community?</i18n>
        </label>
        <showIf operator="Equal" value="Other" datatype="string">
            <Element ElementID="idOfTheOtherField"/>
        </showIf>
        <showIf operator="Equal" value="yetOther" datatype="string" join="or">
            <Element ElementID="idOfTheOtherField"/>
        </showIf>
        <style width="60%"/>
    </display>
</displays>displays is the container containing as many display element blocks as there are uiLayout templates defined.
display is the set of attributes and tags that manages the way the element is displayed or rendered in the specific view. The display tag contains the following attributes:
- 
showcan take a value of true/false and determines if the element should display at all in the uiLayout. - 
modecontains the reference to the uiLayout in which it will render. (see above ....) - 
widgetdefines the display widget that will be used in the uiLayout to render the element. A comprehensive list of widgets available for different elements are presented below. widget - 
labelis the block that contains the natural language text of the label of the element.- 
showis the attribute to control whether the label should render, or only the data element. If the show is set to false, the label will not render. - 
i18nis the tag for the label in a specific language. and data part and the label renders in the selected language. Multiple language labels may be defined. - 
xml:lang="en" this attribute specifies the language. The value 
"en"is the ISO 639-1 code for English. 
 - 
 - 
showIf- TheshowIftag allows for a conditional rendering of the element as a whole determined by a logical condition based on the value of another field. If theshowIftag is present, the user interface logic looks to theshowIfconditional XML tag node set, which evaluates to true or false. If the condition evaluates to true, then the field displays in the user interface, otherwise it does not. The conditionality is defined by the folliwing attributes and tags:- 
operatoris an attribute with possible values of: ("Equal","GreaterThan","GreaterThanOrEqual","LessThan","LessThanOrEqual","MaxLength","NotEqual","NotNull","Required","UniqueInColumn","UniqueInDomain"). - The 
valueattribute contains the value to which the contents of the other field must be compared. - The 
Elementtag contains the identity of the other field in the component to be compared, by specifying the value of that field's identity in theElementIDattribute value. In the example code the id of the other field is"idOfTheOtherField". - The 
joinattribute can have values of"or"/"and"and can be used in subsequent repeatingshowIftags beneath each other. In this case, eachshowIftag is evaluated in turn and the true/false result of each, is linked together with a logical of thejoinvalue. This produces something like:showIforshowIforshowIf... , meaning that if any one of theshowIfs is true, the evaluation stops and the display remains on. 
 - 
 - 
styleis a tag with thewidthattribute- 
widthattribute specifying a value as a "00%" of the panel that the display element may occupy. 
 - 
 
The element types above may be used to render many user interface element displays. The table below shows the user interface widgets and which data object element types may contain them.
| # | Type | Widget | Notes | 
|---|---|---|---|
| 1 | elField | 
link | 
Displays a hyperlink | 
| 2 | elField | 
textbox | 
Normal text box | 
| 3 | elField | 
textarea | 
Memo area | 
| 4 | elField | 
richbox | 
Rich text area | 
| 5 | elUpload | 
fileUpload | 
Displays a file upload link or photo button | 
| 6 | elField | 
checkbox | 
Checkbox | 
| 7 | elField | 
datePicker | 
Date chooser | 
| 8 | 
elField, elUpload, elSelect
 | 
label | 
A natural language text label | 
| 9 | elField | 
richlabel | 
Rich text label | 
| 10 | elSelect | 
combobox | 
Drop down combobox | 
| 11 | elField | 
image | 
Image | 
| 12 | elField | 
video_edit | 
Video object | 
| 13 | elField | 
video_object | 
Video object | 
| 14 | elField | 
preview | 
Document preview | 
| 15 | elField | 
iframe | 
iframe | 
| 16 | elField | 
radio | 
Radio button | 
| 17 | elUpload | 
image | 
Upload an image file | 
| 18 | elUpload | 
download | 
Download a previously uploaded image or file. Deprecated? | 
| 19 | elUpload | 
upload | 
Upload a file | 
| 20 | elUpload | 
preview | 
Preview a previously uploaded image or file. Pared with camera
 | 
| 21 | elUpload | 
camera | 
Upload an image file directly from the camera. Pared with preview
 | 
- The 
datatab only appears in the following two element type XML tab node sets and the structure in each is different from the other: 
fieldData is the container that controls four aspects of data in a field, which are: The type; the format; whether it's indexed or not; and its default value.
<fieldData dataType="string" dataFormat="text" index="true">
    <default>
        <value>Active</value>
    </default>
</fieldData>- The 
dataTypeattribute ensures that only that data type can be captured. 
Table of data type attribute values:
dataType | 
|---|
| string | 
| integer | 
| float | 
| decimal | 
| memo | 
| date | 
| dateTime | 
| boolean | 
| number | 
| element | 
| currency | 
- The 
dataFormatattribute controls the display format according to the value of the attribute. 
Table of data format attribute values:
dataFormat | 
|---|
| string | 
| integer | 
| float | 
| URI | 
| date | 
| coordinateDMS | 
| geoPoint | 
| yesNo | 
| boolean | 
| text | 
| html | 
| richText | 
| currency | 
| #,##0 | 
| memo | 
| Rmil #,##0.0 | 
| #,##0.00 | 
| R #,##0.00 | 
- The 
defaulttag contained in thefieldDatatag provides avaluetag which contains the default value of the field. Though tags are generally used when multiple occurrences are possible, it only makes sense to have a singledefaulttag in thefieldDatatag. - The 
indexattribute is used to indicate 
- 
validationsare sequentially ordered constraints imposed on the input data of a field. There can be any number ofvalidationtags. They can besimpleorcomplex. Thesimpletag has the following three attributes:- 
typehas possible values of ("required", "...") - 
dataTypehas possible values of ("boolean", "...") - 
valuehas possible values of ("true", "false","NUMERIC","string","blob" "...") - . An example follows:
 
 - 
 
<validation seq="1">
    <simple type="required" dataType="boolean" value="true"/>
    <errorMessage>
        <i18n xml:lang="en">This field is required</i18n>
    </errorMessage>
</validation>help presents on the user interface as a link to a help text specific to the element. It is multi language enabled, and the browser will select the correct language if available.
- The 
showattribute have possible values of: ("true" or "false"). If it is false the help link does not appear. - 
i18nis the natural language help text.- 
xml:langis natural language code attribute following the i18n standard which is selected by the browser as appropriate depending on the browser language settings. 
 - 
 
<help show="true">
        <i18n xml:lang="en">Please select an option</i18n>
</help>