Ian,
I use an action/control page as the target of my form.  Then I call methods
in my CFC to validate input and save the results.  Based off of Dave Watt as
and others recommendations, I use <cftry> blocks in my action page to
capture exception messages from the CFC.  My action page then either
<cfincludes> the form page if input errors or displays a success message and
the next page.

Andy

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Ian Skinner
Sent: Tuesday, September 23, 2003 1:40 PM
To: CF-Talk (E-mail)
Subject: [CFCDev] 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>
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

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 word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

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

Reply via email to