Using CFC as Controller for the action of a form works very well with CFMX,
especially for "MVC" implementation.

You just have to do a redirect to the next view/display layer at the end of
the method (for example with a cflocation).

More info here :
http://www.benorama.com/coldfusion/patterns/part2.htm


Benoit Hediard
www.benorama.com


-----Message d'origine-----
De : Ian Skinner [mailto:[EMAIL PROTECTED]
Envoyé : mardi 23 septembre 2003 20:40
À : CF-Talk
Objet : Using a CFC as the action of a form.


I am trying to figure out the logical flow of processing when using a CFC as
the action of a form?  Where does the application end up?  What scope does
any data returned at the end of the called function with <cfreturn ...> end
up in?  Basically how does this work and how does one use this
functionality?

The below example works in that the correct function of the method is
called, the correct parameters are passed and the query returns the correct
data.  But now what?  What I would like is that the query is returned from
this function so that I can deal with it in the display layer of my
application.  But, I can't figure out how to get out of the function?

Any suggestions or links to reference material would be most appreciative.

Thank You.

--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

An Example:

Simple search form in Search.cfm
<form action="search.cfc" method="post">
        Mobile ID: <input type="text" name="MOBLID">
        First Name: <input type="text" name="FName">
        Last Name: <input type="text" name="LName">
        <input type="hidden" name="Method" value="Mobile">
        <input type="submit" name="submit" value="Search">
</form>

Simple but fairly large Search query in the Mobile Method of Search.cfc
        <cffunction name="Mobile"
                        access="remote"
                        returntype="query"
                        hint="Search for mobile drive contact.">

                <cfargument name="MOBLID"
                                type="string"
                                required="false"
                                default=""
                                hint="ID of mobile drive">
                <cfargument name="LName"
                                type="string"
                                required="false"
                                default=""
                                hint="Last name of contact for mobile
drive.">
                <cfargument name="FName"
                                type="string"
                                required="false"
                                default=""
                                hint="First name of contact for mobile
drive.">
<cfdump var="#arguments#">
                        <cfquery name="MobContact" datasource="STPR">
                                ... SQL here ...
                        </cfquery>
<cfdump var="#MobContact#">
                <cfreturn MobContact>
        </cffunction>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:138191
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to