Skip to main content
A Open Source Solution
Home Download Support Configuration Development ImagoX

The Forms extension allows developers to create new field validators by extending the FieldValidator class. All field validators listed here are in the org.xenei.imagoX.forms package.

Field Validation is performed both during a GET call and during a POST call. During a GET validation formats the fields if requried. During the POST operation a two phase validation is performed. First the value of the fields are validated by the field validation rules. Second, if all fields have been validated, the resulting output may be transformed into a new element.

Class and Use GET POST phase 1 POST phase 2
FieldValidator
The default validator and the base class for all Field Validators.
Does nothing. Appends the value as a text child node. Appends the value as a text child node and performs a copy (See copy section below).
ChoiceValidator
Validates a choice list. An xform:choice is a list of choices contained within an xform:select element. All choice elements must have the same xform:name as the xform:select element that encloses them. The value of the selection may be defined in a xform:value attribute, or as an enclosed text node.
Sets xform:selected attribute if the value has been selected. Sets the xform:selected attribute if the value has been selected. Does nothing as the enclosing xform:select will remove this element type upon form validation.
DateValidator
Creates a multi segment date input field consisting of a month, day and year.
Creates a day drop down list ( xform:select ), a month drop down list ( xform:select ) and a year input field ( xform:number ). Created fields are named <xform:name>Day , <xform:name>Month , and <xform:name>Year respectively. The xform:calendar attribute may be used to specify a calendar implementation to use in validating the date values. If it is not defined java.util.GregorianCalendar is used. Sets the <xform:name>Day , <xform:name>Month Month, and <xform:name>Year attributes. Performs a copy (see copy section below) and then appends the following attributes: xform:month (month string), xform:monthNum (month number, zero based), xform:day (day number), xform:year (year number), xform:calendar (the implementation of java.util.Calendar used to validate the date values), xform:value (the number of milliseconds from Jan 1, 1970 00:00:00, negative numbers being before Jan 1, 1970).
EmailValidator
Creates a text input field that only accepts valid email formats.
Does nothing. Ensures that the email address has an at-sign ( @ ), that the at-sign is not in the first position or the last position. That there is at least one dot ( . ) after the at-sign and that it does not contain any of the following characters: `#$%^&*()+=|]}[{";:,>< Appends the value as a text child node and performs a copy (See copy section below).
ImageValidator
Creates an image button.
Does nothing. If the image has been selected set the xform:x value and xform:y value indicating where in the image the selection was made, appends the value to the element. Appends the value as a text child node and performs a copy (See copy section below).
NumberValidator
An input that only accepts numbers.
Does nothing. Verifies the input value can be interpreted as a number by the java.lang.Double.valueOf() method. Also appends the value as a text child node. Appends the value as a text child node and performs a copy (See copy section below).
SelectValidator
The validator for a selection list. The selection list contains elements of type xform:choice (see ChoiceValidator above).
Does nothing. Sets the value to the selected choice. Performs a copy (See copy section below) and removes all enclosed xform:choice elements.

Copy Section

Many of the input types, the root node and any node in the xform namespace not listed above is copied from the input document to the output document after validation according to the following process.

If the element has an xform:remove attribute the element and all enclosed children are removed. Nothing is added to the result and the copy is complete.

Otherwise if the xform:name attribute is specified the new element name will be set to that value. This may be a fully qualified name or a simple name. If a simple name is specified the element will not have a namespace defined. If not specified and the element is in the xform namespace the result element will be called xform:unknown ; otherwise the element will be cloned. Next any attributes that are not in the xform namespace are copied to the result and the result returned.

If the prefix ( xform in our examples) of the new element is not known in the current transform its URI may be specified with the xform:NS attribute. If the namespace is known this attribute is ignored.

All trademarks and copyrights are the property of their respective owners.
Copyright © 2002-2004 by Xenei.com, All Rights Reserved
OpenSource.org
AnyBrowser.org
Xenei.org - Open Source Solutions