I've been trying to figure out how to use a CFC for validating form
data, but I can't find any info on how the code should be constructed.

I've been using the CFC and the form variables in the code, but I'm
trying to get away from accessing data directly in the CFC.

The invocation I'm using:

<cfinvoke    component                   =   "components.comments"
                   method                         =   
"validate_comment_data"
                   argumentCollection      =   "form"
                   output                           =   "false"
                   access                          =   "public"
                   returnVariable              =   "form_errors">

Then I just use the CFC like this:

<cffunction   name             =   "validate_comment_data"
                    displayname  =   "validate_comment_data"
                    hint                =   "Validate comment form data 
before inserting or updating"
                    output            =   "false"
                    access           =   "public">

     <cfset form_errors = structNew()>

     <cfif not len(trim(form.first_name))>
          <cfset form_errors.first_name = "Please enter your first name.">
     </cfif>

     <cfif not len(trim(form.last_name))>
          <cfset form_errors.last_name = "Please enter your last name.">
     </cfif>

     etc....

     <cfreturn form_errors />

</cffunction>

But how would I change the cffunction code to make use of the 
argumentCollection = "form"
variables?

<cfif not len(trim(arguments.first_name))> ???

Some clues for the clueless, anyone?

Thanks,

Rick

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314282
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to