cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <>
Subject Enhancement for ValidatorActions
Date Thu, 12 Jul 2001 18:44:26 GMT
It is quite common to insert information into a database after you
validate the form.  Since I like to encapsulate all my information
into ActionSets, I found this to be a problem--esp. since the
database actions always return a Map.  Since I _only_ want the
information saved to database if the form is validated correctly,
I enabled the ability to embed actions inside other actions in an

For Example:

  <map:action-set name="process">
   <map:act type="form" action="Create Department">
     <map:parameter name="validate-set" value="add"/>
     <map:act type="dbAdd"/>
   <map:act type="form" action="Update Department">
     <map:parameter name="validate-set" value="update"/>
     <map:act type="dbUpd"/>
   <map:act type="dbDel" action="Delete Department"/>

With this Action set the DatabaseAddAction or the DatabaseUpdateAction
is only executed when the FormValidatorAction is successful.  This also
preserves the functionality if this pipeline:

<map:match pattern="*-dept.html">
  <map:act set="process">
    <map:parameter name="descriptor" value="context://docs/department-form.xml"/>
    <map:parameter name="form-descriptor" value="context://docs/department-form.xml"/>
    <map:generate type="serverpages" src="docs/confirm-dept.xsp"/>
    <map:transform src="stylesheets/ipms.xsl"/>
  <map:generate type="serverpages" src="docs/{1}-dept.xsp"/>
  <map:transform src="stylesheets/ipms.xsl"/>

This is the type of pipeline that the Forms instructions tell you to use.
Since they specified only one action working--I wanted to have it work with
a whole set.

This really should have been active, but the semantics of checking for redirection
complicate things mildly.  This change does not break the sitemap, so precompiled
sitemaps will still work with Cocoon.
View raw message