A container that allows specifying the form validation rules defined by its one or more validator element children.
Parameters
Parameter | Description |
---|---|
list-of-validators (required) | A list of one or more validator elements. |
Remarks
validation
is allowed as a trait of any control, but if present, it must
be either the very first child element, or, if declarations
is also declared,
the first child element following declarations
.
Sample
<form id='validatorSample' menuName='Validation' platforms='web' xmlns="http://schemas.mobilengine.com/fls/v1"> <textbox label='Required text'> <validation> <validator cond='{text != ""}' message='This field is required.'/> </validation> </textbox> <checkbox id='terms' text='I have read and agree to the Terms & Conditions'> <validation> <validator cond='{terms.checked}' message='You need to agree to the terms'/> </validation> </checkbox> <datepicker id='start' label='From' dateFormat='(dtf yyyy"/"MM"/"dd)'> <validation> <validator cond='{date >= sysp.dtlFormOpen}' message='Date can't be earlier than today'/> </validation> </datepicker> <datepicker id='end' label='To' dateFormat='(dtf yyyy"/"MM"/"dd)'> <validation> <validator cond='{(dtl 2018-03-19T00:00:00) > date}' message='Date can't be later than expiry date'/> </validation> </datepicker> <datepicker label='Pick a date between start and end' dateFormat='(dtf yyyy"/"MM"/"dd)'> <validation> <validator cond='{date BETWEEN start.date AND end.date}' message='Date must be between the start and end dates'/> </validation> </datepicker> <dropdown choices='{SELECT r.words, r.more_words FROM randomWord r}' keyMap='{words}' textMap='{more_words}'> <validation> <validator cond='{selectedKey IS NOT NULL}' message='You need to select an option'/> </validation> </dropdown> <textbox label='Enter a random word'> <validation> <validator cond='{text IN (SELECT q.words FROM randomWord q)}' message='That's not random enough'/> </validation> </textbox> </form>
An overview of the types of validation
A workflow script running in the Mobilengine Cloud would access the validated submission of the webform above in the following format:
{... terms: {checked: true}, start: {date: 2015.08.26. 0:00:00 (Dtl)}, end: {date: 2015.12.17. 0:00:00 (Dtl)}, selectedKey: "hogwash", selectedText: "tiger", selectedValue: {words: "hogwash", more_words: "tiger"} ...}
See the workflow script reference guide for more details on data type mapping.