Documentation - XML Form Generator Form Definitions
Documentation - XML Form Generator Form Definitions
The field elements are the main elements in your form. These hold all the inputs and can
direct the data to the card. The attributes of the field elements depend on the type of
field, although all fields have a mandatory name attribute, which must be unique within
the form. All field have the optional dependencies, mandatory(false),
placeLabel(onLeftSide or onTop for memoField), disabled(false), hidden(false),
inoverview(ifFilled, always, never), activeAfterTabOnField, clearValueWhenHidden(false)
and note(false) attributes (default values in parentheses), some have additional
mandatory and/or optional attributes. For information about the possible validations per
field element one can read the specific documentation on validations. All available field
elements and their additional attributes follow below (TD means TOPdesk styling):
-
textField: A normal input box with a {label [text input box]} set up
memoField: A normal text area (TD) input box, optional attribute rows (number,
controls the height)
- checkboxField: A {checkbox[] label} set up, optional attributes: checked(false)
- checkboxGroupField: A group of {checkbox[] label} inputs with optional attributes
orientation(vertical) and checked(false) has an option list with optional attributes:
selected(false) and note(false)
- radioField: A {label o radio button} set up with optional attributes:
orientation(vertical), has an option list with optional attributes: selected(false),
nextform (a form name) and note(false)
- selectField: A select input box with a {label [dropdown select box]} set up, has
optional attributes: emptyoption(false) and an optionlist with optional attributes:
selected(false)
- suggestField: A autocompleter input box (TD) with a {label [autocompleter box]}
set up, has mandatory attributes: table, optional attributes:
column(naam/ref_dynanaam), displayexpression, parent, parentcolumn, filter,
filterexpression, openLinksInCurrentWindow(false) and disableFilters.
- gridField: A grid of database entries. Mandatory options are: table and columns.
Optional attributes are: filter, filterexpression, columnWidths, searchColumns,
linkColumns, parent, parentcolumn, checked(false),
openLinksInCurrentWindow(false) and disableFilters.
- dateField: A date input box (TD) with a {label [date input box]} set up
- timeField: A time input box (TD) with a {label [time input box]} set up
- datetimeField: A date & time input box (TD) with a {label [date input box][time
input box]} set up
- infoField: A pure text label with a {label note} set up. Optional attributes are:
labelExpression and noteExpression.
- emptyField: A bit of vertical whitespace, purely a layout tool.
- uploadField: An upload box with a {label [file browser]} set up; using these
without validations is not recommended.
The note attributes can have values false(default), text and html. A note will show an info
icon with a mouse-over tooltip which displays a text or html text as defined in the
properties. The selectField emptyoption will show an empty 'null' option which 'doesn't
count as a valid selection' and can therefore be validated where needed. The label for this
text entry can be set in the properties.
The radioField, checkboxgroupField and selectField must have a <data> child group with
all options in the group as <option> children, the option list. The data tag has no
attributes, the option element has the mandatory unique name attribute and an optional
selected(false) attribute. An option may also have the nextform attribute, which
determines the form that is shown if that option has been selected.
A suggestField has the most extra attributes: it has a mandatory table attribute, which
should have the value of a TD database table (exact name). It has an optional column
attribute, which can have the value of any of the columns in the aforementioned table. If
no column is entered, it will automatically display the naam column for most tables,
ref_dynanaam for person, etc. If you need to display a combined name you can utilize
the displayexpression attribute which takes a foxpro expression to combine one or more
values of a card.
To mimic the standard TD functionality of category/subcategory or branch/location links,
there are also the optional attributes parent and parentcolumn. The parent attribute
should get the value of the higher level suggest field, the parentcolumn the value of the
column in the source table of the child element that links the two tables.
<suggestField name="branch" table="vestiging"/>
<suggestField name="location" table="locatie" parent="branch" parentcolumn="vestigingid"/>
will provide two autocompleters with the lower one linked to the value selected of the
upper one, both displaying the names of the cards. Additionally, to implement a set of
category/subcategory fields, one needs to add a so-called filterexpression to each of the
suggestFields:
<suggestField name="category" table="classificatie" filterexpression="ISNULL(parentid) AND
incidentbeheer"/>
<suggestField name="subcategory" table="classificatie" parent="category" parentcolumn="parentid"
filterexpression="NOT(ISNULL(parentid)) AND incidentbeheer"/>
where the incidentbeheer condition depends on the module these fields values will be
used in. This filterexpression attribute also allows you to create suggestFields containing
optional search list values:
<suggestField name="optionallist" table="vrijeopzoekvelden" filterexpression="code = 'INCIDENT_1'"/>
As shown,filterexpression causes the fields data source to be filtered on an additional
FoxPro expression, which may also be used to filter on a certain prefix or suffix:
<suggestField name="topdeskbranch" table="vestiging" filterexpression="LOWER(LEFT(naam, 7)) =
'topdesk'"/>
This field will only show branches with a name starting with topdesk (case-insensitive).
If these filtering options do not suffice for your purposes, you can contact the bespoke
work team to develop a custom filter which may then be used by specifying the filter
attribute.
<suggestField name="operator" table="actiedoor" filter="onlyoperatorsinthesamegroupascurrentuser"/>
Here, the filter value is the name tag that can be used for a certain filter on the query on
the TOPdesk database that fills the autocompleter. The bespoke work team will build the
filter as required and give it the name the customer-consultant team thought up for that
specific filter. Once made, the filter can be (re-)used on any suggestField by providing the
filter attribute that name.
Your form will be a lot easier to maintain if, within the form element, every
name is kept unique. Fields must be unique per form, groups per row and rows
per form, so overall form uniqueness is not enforced, but it will make your life a
lot easier.
All values in the XML attributes must be pure letters/numbers, no spaces, no
underscores, no dashes or special symbols. All lower caps is preferred.
One reason to keep your forms unique is the use of dependencies. The attribute
dependencies is an optional attribute which can be used in rows, groups and fields. The
value of this attribute represents a field in the form which has to have a certain value for
the element that has the dependencies to display:
<radioField name="folderaccess">
<data>
<option name="yes"/>
<option name="no"/>
</data>
</radioField>
<textField name="foldername" mandatory="true" dependencies="folderaccess:yes"/>
here the field foldername, a textbox, will be shown if the radio button yes of the field
folderaccess is selected. Then it will also be mandatory.
<checkboxField name="orderhardware" note="text"/>
<selectField name="requesttype" note="text">
<data>
<option name="software"/>
<option name="hardware"/>
<option name="both"/>
</data>
</selectField>
<row name="hardware" dependencies="orderhardware:checked; requesttype:hardware,both"/>
will show the row hardware if the checkbox orderhardware is checked and/or the select
requesttype has hardware or both selected.
The dependencies attribute supports two different syntaxes:
1. The simple and short variant 'orderhardware:checked; requesttype:hardware,both' like the
one above.
2. Or it can be written as a FOX-PRO expression like so: 'form_row_group_orderhardware OR
form_row_group_requesttype = 'hardware' OR form_row_group_requesttype = 'both''
Dependencies are a powerful layout tool, but the best way to see how they work is to just
run some tests with them.
(example form has a filled form properties file, so labels are shown correctly)
These forms will display all name attributes as labels, first letter capitalized, rest lower
case, unless these names have been specified in a properties file. These files hold the
resources for the forms.
The keys and values for the above example would be these:
form1 = Incident ICT Department
form1.information = The ICT department manages all IT related items
form1.caller = Caller
form1.caller.caller.callername = Caller
form1.caller.caller.branch = Site
form1.caller.caller.ref_plaats1 = City
form1.caller.caller.telefoon = Telephone number
form1.caller.caller.ref_locatie = Location
form1.description = Description
form1.description.description.typeofcall = Type of call
In general a key is built up in this way:
formname = value (form title)
formname.rowname = value (row title)
formname.rowname.groupname.fieldname = value (field label)
formname.rowname.groupname.fieldname.optionname = value (option label)
formname.rowname.groupname.fieldname.note = value (value of tooltip)
The properties files can be generated by the tool. After loading the form XML file in the
tool by opening the index page (for the SSD this would be /tas/public/xfg on your TAS) in
any browser, redirect to the URL /tas/public/xfg/tools/?language=en (or nl or de for the
dutch/german language file) and the tool will generate the properties file for that
language. It will provide all possible keys and use any existing properties file as to not
overwrite existing key-value pairs. For new keys, the base value is entered as one can see
when using a valid xmlform without properties. Leaving a value empty results in an
empty label as would be expected. If you have modified a properties file you should note
that it should be saved as an UTF-8 encoded textfile (Using wordpad as an Unicode text
document). If you do not save it in that encoding non ASCII characters such as a will
not be rendered correctly.