cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stev...@outerthought.org
Subject [WIKI-UPDATE] WoodyValidationRuleReference WoodyEventHandling Sun Nov 2 07:00:03 2003
Date Sun, 02 Nov 2003 06:00:04 GMT
Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyValidationRuleReference , version: 2 on
Sun Nov  2 05:11:20 2003 by AntonioGallardo

- 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:
?                               -           -

+ 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:
?                                                                                        
                                                                 ++              ++

- To provide locale-dependent messages, use i18n tags in combination with the I18nTransformer.
+ To provide locale-dependent messages, use i18n tags in combination with the [I18nTransformer|I18NTransformer].
?                                                                             +          
    +++++++++++++++++

+ Often the values that validation rules will check are specified as expressions. Woody use
for this task the [xReporter expression interpreter|http://xreporter.cocoondev.org/en/expressions.html]
- 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]
+ !!! Summary
- !!!length
+ ||Validator||Allowed datatypes||
+ |assert|all datatypes|
+ |email|string|
+ |length|string|
+ |mod10|string|
+ |range|integer, long, decimal|
+ |regexp|string|
+ |value-count|all datatypes as part of multivaluefield|
- Can be used in combination with these datatypes: string.
+ !!!Description
- 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.
+ !!assert
- !!!email
+ Evaluates the expression specified in the "test" attribute. This expression should have
a boolean result, it should evaluate to either true or false. Example: Suppose there are 2
fields widgets {{password}} and {{confirmPassword}}. We can use assert inside {{confirmPassword}}
to check if is equals to {{password}} widget:
+ {{{
+ <wd:assert test="password = confirmPassword">
+   <wd:failmessage>The two passwords are not equal.</wd:failmessage>
+ </wd:assert>
+ }}}
- Can be used in combination with these datatypes: string.
+ !!email
- Checks that a value is a valid email address.
+ Checks that a value is a valid email address. Example:
?                                              +++++++++

+ {{{
+ <wd:email/>
+ }}}
- !!!range
+ !!length
- Can be used in combination with these datatypes: integer, long, decimal.
+ 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. Example:
+ {{{
+ <wd:length min="2" max="4"/>
- 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.
+ Another example:
- !!!assert
+ <wd:length exact="2*2">
+    <wd:failmessage>Must be 4 4 characters long!</wd:failmessage>
+ </wd:length>
+ }}}
- Can be used in combination with these datatypes: all datatypes.
+ !!mod10
- Evaluates the expression specified in the "test" attribute. This expression should have
a boolean result, it should evaluate to either true or false.
+ 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. Example:
+ {{{
+ <wd:mod10>
+    <wd:failmessage>Invalid credit card number.</wd:failmessage>
+ </wd:mod10>
+ }}}
- !!!value-count
+ !!range
- Can be used in combination with these datatypes: all datatypes as part of multivaluefield.
+ 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. Example:
+ {{{
+ <wd:range min="2" max="4"/>
- Checks the number of items selected in a multivaluefield. Again works with min, max and
exact attributes.
+ Another example:
- !!!regexp
+ <wd:range exact="2*2"/>
+ }}}
- Can be used in combination with these datatypes: string
+ !!regexp
- 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.
+ 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:
?                                                                                        
                                                                                         
                                                                                         
      +++++++++

- 
- Example:
- !!!mod10
+ !!value-count
- Can be used in combination with these datatypes: string
+ Checks the number of items selected in a multivaluefield. Again works with min, max and
exact attributes. Example:
+ {{{
+ <wd:value-count min="2" max="4"/>
- 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.
+ Another example:
+ <wd:value-count exact="2"/>
+ }}}
+ 


Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyEventHandling , version: 7 on Sun Nov 
2 05:36:23 2003 by AntonioGallardo

- * by registering a org.apache.cocoon.woody.event.FormHandler on the Form object. This FormHandler
will receive all events from all widgets.
+ * by registering a {{org.apache.cocoon.woody.event.FormHandler}} on the Form object. This
FormHandler will receive all events from all widgets.
?                    ++                                         ++

- To handle events using a FormHandler, write a class implementing the org.apache.cocoon.woody.event.FormHandler
interface. Alternatively you can extend from the abstract class org.apache.cocoon.woody.event.AbstractFormHandler,
which will split ActionEvents and ValueChangedEvents to two different methods. See the [javadocs|Javadocs]
of these interfaces and classes for more details.
+ To handle events using a FormHandler, write a class implementing the {{org.apache.cocoon.woody.event.FormHandler}}
interface. Alternatively you can extend from the abstract class {{org.apache.cocoon.woody.event.AbstractFormHandler}},
which will split ActionEvents and ValueChangedEvents to two different methods. See the [javadocs|Javadocs]
of these interfaces and classes for more details.
?                                                                      ++                
                        ++                                                               
 ++                                                 ++




Mime
View raw message