"should only call the manager" is a bit binding, but the idea is that,
generally, the framework only interacts with the domain model by going
through the manager. However, in this case I wouldn't see any issue
with adding validate() to the Product CFC, then calling that method
from your circuit XML. So you might end up with something like:

<fuseaction name="processnewproduct" access="public">
               <invoke object="application.productManager"
                               methodcall="getProduct( attributes )"
                               returnvariable="user"/>
               <if condition="#product.validate()#">
                       <true>
                               <!-- Validation successful? -->
                               <invoke object="application.productManager"
                                               methodcall="save( product )"/>
                               <relocate
url="#myFusebox.originalCircuit#.success"/>
                       </true>
                       <false>
                               <!-- If not successful, display the
form again. -->
                               <do action="productForm" />
                       </false>
               </if>
       </fuseaction>


On 8/30/05, wolf2k5 <[EMAIL PROTECTED]> wrote:
> On 8/29/05, Brian Kotek <[EMAIL PROTECTED]> wrote:
> > I would take the form data, put it into a Bean as we've been talking
> > about in the Bean thread,  validate it, and use the data if it passes
> > validation, but redisplay the form if it fails. Something like this:
> >
> > <fuseaction name="processregistration" access="public">
> >                 <invoke object="application.beanFactory"
> >                                 methodcall="getBean( 'User', attributes )"
> >                                 returnvariable="userBean"/>
> >                 <if condition="#userBean.validate()#">
> >                         <true>
> >                                 <!-- Was the registration successful? -->
> >                                 <invoke object="application.userManager"
> >                                                 
> > methodcall="processRegistration( userBean )"/>
> >                                 <relocate 
> > url="#myFusebox.originalCircuit#.success"/>
> >                         </true>
> >                         <false>
> >                                 <!-- If registration was not successful, 
> > display the registration
> > form again. -->
> >                                 <do action="register" />
> >                         </false>
> >                 </if>
> >         </fuseaction>
> >
> > At some point when I have time (ha!) I'd like to update this app in
> > several ways, using Beans and the related factory, and possibly
> > showing AJAX in use (using JSON).
> 
> Let's say I want to add form data validation to the Wegot Widgets
> Fusebox 4.1 OO MVC application, there are four CFCs for the product:
> 
> Product.cfc
> ProductManager.cfc
> ProductDAO.cfc
> Productgateway.cfc
> 
> To which CFC should I add the validate() method?
> 
> If I understand it correctly, the Fusebox controller should only call
> the ProductManager CFC.
> Is that right?
> 
> Thanks a lot.
> 
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to 
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the 
> email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
> (www.cfxhosting.com).
> 
> CFCDev is supported by New Atlanta, makers of BlueDragon
> http://www.newatlanta.com/products/bluedragon/index.cfm
> 
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[email protected]
> 
> 
>


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to