0

Handleing Results in Model-Glue

code, ColdFusion, CFC, model-glue

Ok I am not the world’s best blogger but I am going to give a shot. So I am working on a Model-Glue Application that I started about a year and a half ago. And I am finally starting to reuse some of my functions. For example I have a saveUserAddress function and a saveUserAccount function and in both of these function’s I add result named success if there wasn’t an error. So here is the problem, we adding a new feature that allows a user to setup a new address and a new account on the same screen but in Model-Glue if there is a result the next function will not be called. So to fix this problem I added an argument to the message in the modelglue.xml file like so.

<message name="SaveUserAddress">
    <argument name="addResult" value="false" />
</message>
<message name="SaveUserAccount" />


Then in the controller component I add some logic to account for this.

<cfif arguments.event.ArgumentExists("addResult")>
    <cfif arguments.event.getValue("addResult") EQ true>
        <cfset arguments.event.addResult("success", true) />
    </cfif>
</cfif>

I know there some Mach-II guys out there so I would like to know how you handle this in Mach-II.


Search

Matt  Graf
View Matt Graf's profile on LinkedIn