I think that in most cases, accessing the form vars in a component ruins the
separation of business and display logic . . . which may be OK depending on
how much of a purist you are.

I think the better solution is to name all of the CFARGUMENTs the same as
your form inputs, then use the ARGUMENTCOLLECTION attribute of CFINVOKE to
pass in the variables.  This is straight from the docs:

        Passing parameters in the argumentCollection attribute
        If you save attributes to a structure, you can pass the structure
directly using the cfinvoke tag's argumentCollection attribute. This
technique is useful if an existing structure or scope (such as the
Forms scope) contains values that you want to pass to a CFC as  parameters,
and for using conditional or looping code to create     parameters.

        When you pass an argumentCollection structure, each structure key is
the name of a parameter inside the structure. 

        The following example passes the Form scope to the addUser method of
the UserDataCFC. In the method, each form field name is a parameter
name. Then the method can use the contents of the form fields to add a  user
to a database. 

        <cfinvoke component="UserDataCFC" method="addUser"
argumentCollection="#Form#">

Hope this helps,
RC Collins

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Christian Cantrell
Sent: Monday, January 12, 2004 11:44 AM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] cfargument question

On Sunday, January 11, 2004, at 11:35  PM, Benjamin Wilson wrote:

> I am using a CFC to process several very long and complicated forms. Is
> their a way to loop over the form var list to build out the cfarguments
> in the cfc dymanically?

Are you submitting the form directly to a CFC?  If so, why not just 
access each form variable individually in the CFC?  Why do they need to 
be in the arguments scope rather than the form scope?

Christian

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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 words '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