Field Specifications

Field specifications, manifest as instances of the C++ class hdsFldspec, created in response to <fldspec> tags in the configs, are shorthand used to standarize the appearence of fields in forms and pages. They comprise a predefined data type, a unique name for reference in the configs, the HTML type, the display dimensions and validation JavaScript. Any JavaScript used must be created prior to the <fldspec> tag using an <xscript> tag as follows:-

    <xscript<
        function isZipcode() {....}
    </xscript<
    <fldspec type="DATATYPE_STRING" html="TEXT" script="isZipcode" name="zipcode"/>

Field specifications have a special role in Dissemino. As they carry the data type, they can be used to set member data types in data class definitions, whilst also stating how the member should appear in a page or form. This is unorthodox because data object members would not normally need to know how they would appear on the screen. Usually the page or form would state what fields look like and would reference the member only as data sink or source. However as a rapid development aid, Dissemino has a facility to generate default forms and form handlers from data class definitions. These tend to be crude but benefit greatly from use of field specifications.

Enumerated Data Types (Enums)

An Enum or enumerated data type, is a mapping of preset strings to numerical values. It is a data type because variables or data object members of the data type, can only be set to values that are found in the map. In HTML forms, enums are presented as selectors (in-field drop-down menus), or as grouped checkboxes or radio buttons. The internal HadronZoo data type of a selector will be ENUM1 if only one option is allowed (xple="false"), or ENUM2 if multiple options are allowed (xple="true"). ENUM1 is a single number from 0 to N-1, where N is the total number of options. ENUM2 is a series of such numbers, encoded as a bitmap.

In Dissemino webapp configs, the HTML for selectors, or checkbox or radio button groupings, is not written explicitly. As enums are a data type, they must be defined before use, as in the example below:-

<enum name="enumSalute" xple="false">
    <option dflt="Please Select"/>
    <option show="Mr"/>
    <option show="Mrs"/>
    <option show="Miss"/>
    <option show="Ms"/>
    <option show="Dr"/>
    <option show="Prof"/>
</selector>

Since defining an enum involves listing the options, there is no need to repeat this information in the form config XML. Instead, a field specification is created, setting the data type to the enum, the HTML type to either SELECT, CHECKBOX, or RADIO, and to state if multiple values are allowed. The field specification is then used to set the parameters in the applicable formm field.