cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stev...@outerthought.org
Subject [WIKI-UPDATE] WoodyValidationRuleReference WoodyTemplateTransformer WoodyWidgetReference WoodyReference WoodyDatatypeReference WoodyEventHandling Fri Oct 31 18:00:10 2003
Date Fri, 31 Oct 2003 17:00:10 GMT
Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyValidationRuleReference , version: 1 on
Fri Oct 31 16:05:42 2003 by BrunoDumon

New page created:
+ !!!General
+ 
+ For each validation rule, the "failmessage" (i.e. the message displayed to the user in case
the validation failed) can be overridden by specifying a child wd:failmessage element inside
the validation rule element. The failmessage can contain mixed content. Example:
+ 
+ {{{
+ <wd:datatype base="string">
+   <wd:validation>
+     <wd:email>
+       <wd:failmessage>Not a valid email address!</wd:failmessage>
+     </wd:email>
+   </wd:validation>
+ </wd:datatype>
+ }}}
+ 
+ To provide locale-dependent messages, use i18n tags in combination with the I18nTransformer.
+ 
+ 
+ Often the values that validation rules will check are specified as expressions. The expression
interpreter used is the one from xReporter, general information about it can be found [here|http://xreporter.cocoondev.org/en/expressions.html]
+ 
+ !!!length
+ 
+ Can be used in combination with these datatypes: string.
+ 
+ Checks the length of strings. This validation rule can take 3 attributes: min, max and exact.
You can use either of these three seperately or min and max together. The values of these
attributes are expressions.
+ 
+ !!!email
+ 
+ Can be used in combination with these datatypes: string.
+ 
+ Checks that a value is a valid email address.
+ 
+ !!!range
+ 
+ Can be used in combination with these datatypes: integer, long, decimal.
+ 
+ Checks the numeric range. This validation rule can take 3 attributes: min, max and exact.
You can use either of these three seperately or min and max together. The values of these
attributes are expressions.
+ 
+ !!!assert
+ 
+ Can be used in combination with these datatypes: all datatypes.
+ 
+ Evaluates the expression specified in the "test" attribute. This expression should have
a boolean result, it should evaluate to either true or false.
+ 
+ !!!value-count
+ 
+ Can be used in combination with these datatypes: all datatypes as part of multivaluefield.
+ 
+ Checks the number of items selected in a multivaluefield. Again works with min, max and
exact attributes.
+ 
+ !!!regexp
+ 
+ Can be used in combination with these datatypes: string
+ 
+ Checks that a string matches a regular expression. It requires a "pattern" attributes specifying
the regexp. The regular expression library used is Jakarta ORO, see [here|http://jakarta.apache.org/oro/api/org/apache/oro/text/regex/package-summary.html]
for some information.
+ 
+ Example:
+ {{{
+ <wd:regexp pattern="[a-z]{3,5}">
+    <wd:failmessage>Invalid code!</wd:failmessage>
+ </wd:regexp>
+ }}}
+ 
+ !!!mod10
+ 
+ Can be used in combination with these datatypes: string
+ 
+ Uses the "mod10" algorithm used to check the validity of credit card numbers such as VISA.
This validation rule does not require any additional attributes.
+ 


Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyTemplateTransformer , version: 5 on Fri
Oct 31 16:39:25 2003 by BrunoDumon

- The WoodyTemplateTransformer (simply "woody transformer" from now on) makes it possible
to define the layout for your form without having to write a seperate XSLT for each form.
If you prefer to do everything with XSLT, you have also the option of using the WoodyGenerator.
+ The WoodyTemplateTransformer (simply "woody transformer" from now on) makes it possible
to define the layout for your form without having to write a seperate XSLT for each form.
If you prefer to do everything with XSLT, you have also the option of using the WoodyGenerator.
In general we recommend to use the woody transformer though.
?                                                                                        
                                                                                         
                                                                                         
     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

- The basic principle is that the woody transformer will replace any <wt:widget id="xyz"/>
elements by the XML representation of the corresponding widgets. These wt:widget elements
can be embedded in e.g. a HTML layout. So after passing this template through the woody transformer
you'll end up with HTML with here and there a piece of XML describing a widget. This XML description
contains all state information of the widget: its value, validation errors and selection-list
data if any, and so on. These widget-XML-descriptions will then typically be translated to
HTML by an XSLT. This XSLT is then however not form-specific, as it simply needs to know how
to translate individual widgets to HTML, and does not have to create the complete page layout.
Woody contains just such an XSLT so you don't have to write it yourself (at the time of this
writing, this XSLT is still quite simple). The image below illustrates this process.
?                                                                                        
                                                                                         
                                                                                         
                                                                                         
                                                                                         
      ^^^^                                                                               
                                                                                         
                                                                                         
                                                                                         
                    ------ --- ------------ ----------------------------------

+ The basic principle is that the woody transformer will replace any <wt:widget id="xyz"/>
elements it encounters by the XML representation of the corresponding widgets. These wt:widget
elements can be embedded in e.g. a HTML layout. So after passing this template through the
woody transformer you'll end up with HTML with here and there a piece of XML describing a
widget. This XML description contains all state information of the widget: its value, validation
errors, selection-list data if any, and so on. These widget-XML-descriptions will then typically
be translated to HTML by an XSLT. This XSLT is then however not form-specific, as it simply
needs to know how to translate individual widgets to HTML, and does not have to create the
complete page layout. Woody contains just such an XSLT so you don't have to write it yourself
(except if you need to do heavy customisation). The image below illustrates this process.
?                                                                                        
        ++++++++++++++                                                                   
                                                                                         
                                                                                         
                                                                                         
                    ^                                                                    
                                                                                         
                                                                                         
                                                                                         
                             +++++++++++++++++++++++++++++++++++++++

- # if the wt:form-template element has a location attribute, then the value of that attribute
will be evaluated as a JXPath expression. The result of this expression should be  the form
object.
?                                                                                        
                                                                                       -

+ # if the wt:form-template element has a location attribute, then the value of that attribute
will be evaluated as a JXPath expression. The result of this expression should be the form
object.
- The wt:widget element is replaced by the woody transformer by the XML representation of
a widget. Which widget is specified by the id attribute. If the wt:widget element has any
content, it will be embedded in the resulting element. This content will be enclosed inside
a wi:styling element, unless it's already a wi:styling element.
+ The wt:widget element is replaced by the woody transformer by the XML representation of
a widget. Which widget is specified by the id attribute. The wt:widget element can contain
a wi:styling element containing parameters to influence the styling process (the XSLT). The
woody transformer will simply copy the wi:styling element over to its output.
+ For example:
- For example, the following:
- {{{
- <wt:widget id="somefield">
-   <list-style>listbox</list-style>
- </wt:widget>
- }}}
- 
- will be replaced by:
- {{{
- <wi:field id="somefield" [...] >
-   [...]
-   <wi:styling>
-     <list-style>listbox</list-style>
-   </wi:styling>
- </wi:field>
- }}}
- 
- (assuming it is a "field" widget)
- 
- Another example, using attributes on wi:styling for styling information:
+   [... label, validation errors, ...]
+ 
+ __Note:__ ''it is not recommended to use the older approach, i.e. without the wi:styling
element, anymore, since support for it will be dropped at some point in the future.''


Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyWidgetReference , version: 2 on Fri Oct
31 16:08:49 2003 by BrunoDumon

- The __wd:datatype__ element indicates the datatype for this field. This element is required.
The __base attribute__ specifies on which built-in type this datatype should be based. The
contents of the wd:datatype element can contain further configuration information for the
datatype. The possible datatypes and their configuration options are described in a seperate
section.
?                                                                                        
                                                                                         
                                                                                         
                                                                                     ^^^ ^^^
  -- ^^ ^^^^^

+ The __wd:datatype__ element indicates the datatype for this field. This element is required.
The __base attribute__ specifies on which built-in type this datatype should be based. The
contents of the wd:datatype element can contain further configuration information for the
datatype. The possible datatypes and their configuration options are described [here|WoodyDatatypeReference].
?                                                                                        
                                                                                         
                                                                                         
                                                                                     ^^^^^^^^^^^^
^^^^  ++++  ^^ ^

- The __wd:selection-list__ element is used to associate a selection list with this field.
See the information on datatypes for more details.
?                                                                                        
     ^  ^^^^ ----- -----        ^

+ The __wd:selection-list__ element is used to associate a selection list with this field.
See [here|WoodyDatatypeReference] for more details.
?                                                                                        
     ^  ^^^^   ++       ^^^^^^^^^^

- The __wd:multivaluefield__ is similar to the field widget but can take multiple values.
A multivaluefield should always have a __wd:datatype__ element with a selection list, since
the user will have to select values from this list. This the wd:multivaluefield could be rendered
as a list of checkboxes or as a listbox in which the user can select multiple items.
?                                                                                        
                                                                               ^

+ The __wd:multivaluefield__ is similar to the field widget but can take multiple values.
A multivaluefield should always have a __wd:datatype__ element combined with a __wd:selection-list__,
since the user will have to select values from this list. This the wd:multivaluefield could
be rendered as a list of checkboxes or as a listbox in which the user can select multiple
items.
?                                                                                        
                                                               +++++++++       +++++     
   ^    ++

- !booleanfield widget
+ !!booleanfield widget
? +



Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyReference , version: 18 on Fri Oct 31 16:06:04
2003 by BrunoDumon

- !!!Widget reference
- 
- Not yet documented:
- 
- * XML output formats of the widgets
- * widget-specific API's
- * default XSLT presentation parameters
- 
- !field widget
- 
- The field widget is the most common widget. It is used both for text
- boxes or selection lists. It can be associated with different datatypes
- such as string, long or date to ask for different types of data.
- 
- Configuration example:
- 
- {{{
- <wd:field id="..." required="true|false">
-   <wd:label>...</wd:label>
-   <wd:hint>...</wd:hint>
-   <wd:help>...</wd:help>
-   <wd:datatype base="...">
-      [...]
-   </wd:datatype>
-   <wd:selection-list .../>
-   <wd:on-value-changed>
-     ...
-   </wd:on-value-changed>
- </wd:field>
- }}}
- 
- The field element takes a required __id attribute__. This id should be unique among all
widgets in the same container (usually the form).
- 
- The __required attribute__ is optional, by default it is false. It indicates whether this
field is required.
- 
- The __wd:label__ element contains the label for this widget. This element is optional. It
can contain mixed content. For internationalised labels, use i18n-tags in combination with
Cocoon's [I18nTransformer|I18NTransformer].
- 
- The __wd:hint__ element contains a hint for the form control of this widget. This element
is optional. It can contain a hint about the input control. For internationalised labels,
use i18n-tags in combination with Cocoon's [I18nTransformer|I18NTransformer].
- 
- The __wd:help__ element contains more help for the form control of this widget. This element
is optional. It can contain text help about the input control. For internationalised labels,
use i18n-tags in combination with Cocoon's [I18nTransformer|I18NTransformer].
- 
- The __wd:datatype__ element indicates the datatype for this field. This element is required.
The __base attribute__ specifies on which built-in type this datatype should be based. The
contents of the wd:datatype element can contain further configuration information for the
datatype. The possible datatypes and their configuration options are described in a seperate
section.
- 
- The __wd:selection-list__ element is used to associate a selection list with this field.
See the information on datatypes for more details.
- 
- The __wd:on-value-changed__ element specifies event handlers to be executed in case the
value of this field changes. See also [WoodyEventHandling]. The interface to be implemented
for Java event listeners is ''org.apache.cocoon.woody.event.ValueChangedListener''. The WidgetEvent
subclass is ''org.apache.cocoon.woody.event.ValueChangedEvent''.
- 
- !multivaluefield widget
- 
- The __wd:multivaluefield__ is similar to the field widget but can take multiple values.
A multivaluefield should always have a __wd:datatype__ element with a selection list, since
the user will have to select values from this list. This the wd:multivaluefield could be rendered
as a list of checkboxes or as a listbox in which the user can select multiple items.
- 
- Configuration example:
- 
- {{{
- <wd:multivaluefield id="...">
-   <wd:label>...</wd:label>
-   <wd:help>...</wd:help>
-   <wd:hint>...</wd:hint>
-   <wd:datatype base="...">
-     [...]
-   </wd:datatype>
-   <wd:selection-list>
-     <wd:item value="...">
-       <wd:label>...</wd:label>
-     </wd:item>
-     [...]
-   </wd:selection-list>
- </wd:multivaluefield>
- }}}
- 
- Most of the elements and attributes have the same meaning as for the
- field widget.
- 
- A multivaluefield cannot have a required attribute, instead you should
- use the "value-count" validation rule to check the number of values
- the user has selected.
- 
- !booleanfield widget
- 
- A __wd:booleanfield__ is a field that has a value of true or false. Usually is rendered
as a checkbox.
- 
- Configuration example:
- 
- {{{
- <wd:booleanfield id="...">
-   <wd:label>...</wd:label>
-   <wd:help>...</wd:help>
-   <wd:hint>...</wd:hint>
- </wd:booleanfield>
- }}}
- 
- !repeater widget
- 
- A __wd:repeater__ widget is a widget that repeats a number of other widgets.
- It can be used to create e.g. tables.
- 
- Configuration example:
- 
- {{{
- <wd:repeater id="...">
-   [...]
- </wd:repeater>
- }}}
- 
- The repeater element should contain a number of other widgets
- to repeat. This can be any of type of widget: field, multivaluefied,
- booleanfield, or even repeater itself.
- 
- Note: the [WoodyTemplateTransformer] has specific support for specifying a template to use
to render each of the rows of a repeater widget. See the "Form1" example of Woody for an example
on how to use this.
- 
- !output widget
- An __wd:output__ widget is similar to a field widget, but its value is not editable. The
value of an output widget must be set programmatically (or through [binding|WoodyBinding]).
An output widget does not read its value from the request, so is most useful in the case where
the form is stored accross requests (e.g. as part of a flowscript or flow-apple). An output
widget does not perform any validation, it is always considered to be valid.
- 
- {{{
- <wd:output id="...">
-   <wd:label>...</wd:label>
-   <wd:help>...</wd:help>
-   <wd:hint>...</wd:hint>
-   <wd:datatype base="...">
-      [...]
-   </wd:datatype>
- </wd:output>
- }}}
- 
- !wd:action
- 
- Used to trigger an action event on the server side. Usually presented as a button the user
can press (though this is not required).
- 
- {{{
- <wd:action id="..." action-command="...">
-   <wd:label>...</wd:label>
-   <wd:help>...</wd:help>
-   <wd:hint>...</wd:hint>
-   <wd:on-action>
-     ...
-   </wd:on-action>
- </wd:action>
- }}}
- 
- The action-command attribute specifies a name that will be part of the event generated by
this widget. It can be used to distinguish events originated from this wd:action from another
one.
- 
- For more information on how event handlers are defined, see [WoodyEventHandling]. The interface
to be implemented for Java event listeners is ''org.apache.cocoon.woody.event.ActionListener''.
The WidgetEvent subclass is ''org.apache.cocoon.woody.event.ActionEvent''.
- 
- !wd:repeater-action
- 
- This is a specific type of action widget that handles the much needed case of adding or
removing rows from a repeater.
- 
- {{{
- <wd:repeater-action id="..." action-command="delete-rows|add-row" repeater="..." select="...">
-   <wd:label>...</wd:label>
-   <wd:help>...</wd:help>
-   <wd:hint>...</wd:hint>
-   <wd:on-activate>
-     ...
-   </wd:on-activate>
- </wd:repeater-action>
- }}}
- 
- The action-command attribute should have either the value "delete-rows" or "add-row".
- 
- If add-row is specified, the attribute repeater is required. If delete-rows is specified,
both the repeater and select attributes are required.
- 
- The repeater attribute should contain the id of the repeater widget on which this repeater-action
should act.
- 
- The select attribute should contain the id of the booleanfield widget (or any type of widget
who's getValue() method returns a boolean) that is part of the repeater and used to mark the
rows to be deleted.
- 
- wd:on-activate allows additional event handlers to be defined, see also [WoodyEventHandling].
The interface to be implemented for Java event listeners is org.apache.cocoon.woody.event.ActionListener.
The WidgetEvent subclass is ''org.apache.cocoon.woody.event.ActionEvent''.
- 
- !other widgets:
- 
- Widgets yet to be documented:
- 
- * __wd:aggregatefield__: used to edit the value of multiple fields through one textbox
- 
- !!!Datatype reference
- 
- !!General
- 
- In its most basic form a datatype is declared as follows:
- 
- {{{
- <wd:datatype base="...">
- }}}
- 
- The __base__ attribute refers to one of the built-in datatypes such as string or long.
- 
- A datatype can have a number of validation rules, for example:
- 
- {{{
- <wd:datatype base="string">
-   <wd:validation>
-     <wd:length exact='4'/>
-   </wd:validation>
- </wd:datatype>
- }}}
- 
- The __wd:validation__ element contains a number of child elements, each child element signifies
a validation rule. The supported validation rules are documented in a seperate section.
- 
- A datatype also needs a convertor. The purpose of a convertor is to convert between string
and object representations of values. There is always a default convertor, but you change
or configure that using the __wd:convertor__ element. Here's an example for dates:
- {{{
- <wd:datatype base="date">
-   <wd:convertor type="formatting">
-     <wd:patterns>
-       <wd:pattern>dd/MM/yyyy</wd:pattern>
-     </wd:patterns>
-   </wd:convertor>
- </wd:datatype>
- }}}
- 
- The __type__ attribute on the wd:convertor element is optional, if not specified the default
one will be used (configured in the cocoon.xconf). Any further content of the wd:convertor
element is specific to the convertor implementation and will be documented in a seperate section.
- 
- Widgets that have a datatype can also have a selection list. Since selection lists are associated
with datatypes, we discuss them here. The selection list can be defined inline or read from
an external source. Example of inline declaration:
- 
- {{{
- <wd:datatype base="long"/>
- <wd:selection-list>
-   <wd:item value="1"/>
-   <wd:item value="2"/>
-   <wd:item value="3">
-     <wd:label>three</wd:label>
-   </wd:item>
-   <wd:item value="4"/>
-   <wd:item value="5"/>
- </wd:selection-list>
- }}}
- 
- Each item in the selection-list can have a value (specified in the value attribute) and
optionally a label (specified in the wd:label element). If no label is specified, the value
is used as label. The wd:label element can contain mixed content.
- 
- Example of getting a selection list from an external source:
- {{{
- <wd:datatype base="string"/>
- <wd:selection-list src="cocoon:/mychoices.xml"/>
- }}}
- 
- All Cocoon-supported protocols can be used. The format of the XML produced by the source
should be the same as in case of inline specification of the selection list, thus the root
element should be a wd:selection-list element.
- 
- By default, the selection list will be retrieved form the source once, and then become part
of the form definition, just like when you would have defined it inline. This has the consequence
that if the XML produced by the source changes, you won't see the selection list changed.
If you'd like Woody to retrieve the content of the selection list each time it needs it, add
an attribute called "dynamic" with value "true", for example:
- {{{
- <wd:datatype base="string"/>
- <wd:selection-list src="cocoon:/mychoices.xml" dynamic="true"/>
- }}}
- 
- If the datatype is different from string, Woody will need to convert the string values that
appear in the selection list to their object equivalent. This conversion is normally done
using the same convertor as the datatype in which the selection list appears, but you can
also specify a different one. Here's an example for a date selection list:
- {{{
- <wd:datatype base="date"/>
- <wd:selection-list>
-   <wd:convertor type="formatting">
-     <wd:patterns>
-       <wd:pattern>yyyyMMdd</wd:pattern>
-     </wd:patterns>
-   </wd:convertor>
-   <wd:item value="13020711"/>
-   <wd:item value="19120623"/>
-   <wd:item value="19690721"/>
-   <wd:item value="19700506"/>
-   <wd:item value="19781014"/>
-   <wd:item value="20010911"/>
- </wd:selection-list>
- }}}
- 
- If there is a wd:convertor element, it should always be the first child element of the wd:selection-list
element. This works of course also for selection lists retrieved from external sources.
- 
- ||Woody Datatype||Java class||Convertors||
- |string|{{java.lang.String}}|Strings obviously don't support any convertors, since there's
no purpose in converting a string to a string.|
- |integer|{{java.lang.Integer}}|similar convertors as the decimal datatype (see below)|
- |long|{{java.lang.Long}}|similar convertors as the decimal datatype (see below)|
- |decimal|{{java.math.BigDecimal}}|formatting (decimal), plain|
- |date|{{java.util.Date}}|formatting (date), millis
- 
- 
- !!Convertors
- 
- !formatting (decimal)
- 
- This convertor uses the {{java.text.DecimalFormat}} class (or {{com.ibm.icu.text.DecimalFormat}}
class if it is present in the classpath). This means it can perform locale-dependent, pattern-based
formatting of numbers.
- 
- Configuration pseudo-schema:
- {{{
- <wd:convertor type="formatting" variant="integer|number|currency|percent" ? >
-   <wd:patterns>
-     <wd:pattern>....</wd:pattern> ?
-     <wd:pattern locale="lang-COUNTRY">....</wd:pattern> *
-   </wd:patterns> ?
- </wd:convertor>
- }}}
- 
- The variant attribute and patterns element are optional. By default, the "number" variant
is used (or for longs: the "integer" variant).
- 
- You can supply either a locale-independent formatting pattern or locale-dependent formatting
patterns. See the [javadoc of the DecimalFormat|http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html]
class for the supported pattern syntax. Woody will always use the pattern that is most specific
for the current locale.
- 
- !plain
- 
- This convertor is not locale-dependent. It shows the full precision of the number and uses
dot as the decimal separator.
- 
- !!date convertors
- 
- The date datatype can be used both for dates as times. The date datatype supports the following
convertors:
- 
- !formatting (date)
- 
- This convertor uses the {{java.text.SimpleDateFormat}} class (or {{com.ibm.icu.text.SimpleDateFormat}}
class if it is present in the classpath). This means it can perform locale-dependent, pattern-based
formatting of dates.
- 
- Configuration pseudo-schema:
- {{{
- <wd:convertor type="formatting" variant="date|time|datetime" ? style="short|medium|long|full"
?>
-   <wd:patterns>
-     <wd:pattern>....</wd:pattern> ?
-     <wd:pattern locale="lang-COUNTRY">....</wd:pattern> *
-   </wd:patterns> ?
- </wd:convertor>
- }}}
- 
- Usually you will use either the variant and style attributes or the pattern(s).
- 
- For example, the following convertor configuration:
- {{{
- <wd:convertor type="formatting" variant="date" style="short">
- }}}
- 
- Will give the following for July 15, 2003: 7/15/03. Using style medium it gives "Jul 15,
2003", style long gives "July 15, 2003", and style full gives "Tuesday, July 15, 2003". These
result are locale-dependent of course.
- 
- Here's an example of using a formatting pattern:
- {{{
- <wd:convertor type="formatting">
-   <wd:patterns>
-     <wd:pattern>dd/MM/yyyy</wd:pattern>
-   </wd:patterns>
- </wd:convertor>
- }}}
- 
- Using the same date, this will now give "15/07/2003".
- 
- It is also possible to use different patterns for different locales by using multiple wd:pattern
elements with "locale" attributes, for example:
- {{{
- <wd:convertor type="formatting">
-   <wd:patterns>
-     <wd:pattern>MM/dd/yyyy</wd:pattern>
-     <wd:pattern locale="nl-BE">dd/MM/yyyy</wd:pattern>
-     <wd:pattern locale="fr">dd-MM-yyyy</wd:pattern>
-   </wd:patterns>
- </wd:convertor>
- }}}
- 
- In this case, if the locale is "nl-BE", the second pattern will be used; if the locale is
"en", the first pattern will be used; and if the locale is "fr-BE" the third pattern will
be used (because when fr-BE is not found, it will first search for "fr" before using the locale-indepent
pattern).
- 
- !millis
- 
- The millis convertor for dates uses the number of milliseconds since January 1, 1970, 00:00:00
GMT as string representation. This will likely not be used to present dates to the user, but
may be useful in selection lists retrieved from external sources.
- 
- !!!Validation rule reference
- 
- !General
- 
- For each validation rule, the "failmessage" (i.e. the message displayed to the user in case
the validation failed) can be overridden by specifying a child wd:failmessage element inside
the validation rule element. The failmessage can contain mixed content. Example:
- 
- {{{
- <wd:datatype base="string">
-   <wd:validation>
-     <wd:email>
-       <wd:failmessage>Not a valid email address!</wd:failmessage>
-     </wd:email>
-   </wd:validation>
- </wd:datatype>
- }}}
- 
- To provide locale-dependent messages, use i18n tags in combination with the I18nTransformer.
- 
- 
- Often the values that validation rules will check are specified as expressions. The expression
interpreter used is the one from xReporter, general information about it can be found [here|http://xreporter.cocoondev.org/en/expressions.html]
- 
- !length
- 
- Can be used in combination with these datatypes: string.
- 
- Checks the length of strings. This validation rule can take 3 attributes: min, max and exact.
You can use either of these three seperately or min and max together. The values of these
attributes are expressions.
- 
- !email
- 
- Can be used in combination with these datatypes: string.
- 
- Checks that a value is a valid email address.
- 
- !range
- 
- Can be used in combination with these datatypes: integer, long, decimal.
- 
- Checks the numeric range. This validation rule can take 3 attributes: min, max and exact.
You can use either of these three seperately or min and max together. The values of these
attributes are expressions.
- 
- !assert
- 
- Can be used in combination with these datatypes: all datatypes.
- 
- Evaluates the expression specified in the "test" attribute. This expression should have
a boolean result, it should evaluate to either true or false.
- 
- !value-count
- 
- Can be used in combination with these datatypes: all datatypes as part of multivaluefield.
- 
- Checks the number of items selected in a multivaluefield. Again works with min, max and
exact attributes.
- 
- !regexp
- 
- Can be used in combination with these datatypes: string
- 
- Checks that a string matches a regular expression. It requires a "pattern" attributes specifying
the regexp. The regular expression library used is Jakarta ORO, see [here|http://jakarta.apache.org/oro/api/org/apache/oro/text/regex/package-summary.html]
for some information.
- 
- Example:
- {{{
- <wd:regexp pattern="[a-z]{3,5}">
-    <wd:failmessage>Invalid code!</wd:failmessage>
- </wd:regexp>
- }}}
- 
- !mod10
- 
- Can be used in combination with these datatypes: string
- 
- Uses the "mod10" algorithm used to check the validity of credit card numbers such as VISA.
This validation rule does not require any additional attributes.
- 


Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyDatatypeReference , version: 2 on Fri Oct
31 16:16:46 2003 by BrunoDumon

+ 
+ !!Validation rules
+ !!Convertors
+ 
+ 
+ !!Selection lists (default implementation)
- !!!Supported datatypes
+ Selection list implementations are pluggable. Everything said until now applies to the default
selection list implementation. An alternative implementation can be specified by using a __type__
attribute on the wd:selection-list element. There is currently one alternative implementation:
__flow-jxpath__.
+ 
+ !!Selection lists: flow-jxpath implemenation
+ 
+ (see the javadoc of the class FlowJXPathSelectionListBuilder for now)
+ 
+ !!!Available datatypes
- !!!Convertors
+ !!!Available convertors


Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyEventHandling , version: 5 on Fri Oct 31
16:59:22 2003 by BrunoDumon

- The Java class specified in the class attribute on the java element should implement a certain
interface. Which interface depends on the type of widget. These are mentioned in the [widget
reference document|WoodyReference].
+ The Java class specified in the class attribute on the java element should implement a certain
interface. Which interface depends on the type of widget. These are mentioned in the [widget
reference document|WoodyWidgetReference].
?                                                                                        
                                                                                         
                                  ++++++




Mime
View raw message