I prefer the first method whenever possible. However it's not really practical with a lot of variables. In that case, I opt for a third method, an argumentCollection:
<cfset variables.createOrder = application.vantage2DS.customerExists(argumentCollection=form) /> I usually don't use form directly, prefering to create a dedicated struct as you did, but either method will work. Inside your method, you'll get named parameters, just as if it had been called with each one listed individually (which helps keep your dependancies from going upwards, and lets you use typechecking and such). The only caveat is that your parameter names need to match up between the method declaration and the argumentCollection, but that's a no brainer. Cheers, barneyb > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Ben Densmore > Sent: Thursday, May 06, 2004 11:50 AM > To: [EMAIL PROTECTED] > Subject: [CFCDev] passing Form fileds as arguments > > I searched through the archives and couldn't find anything directly > related but if this has been asked before I apologize. > > If I have say 20 form fields that are submitted and then need to pass > them in as arguments to a function in a cfc am I better off doing > something like: > > <cfset variables.createOrder = > application.vantage2DS.customerExists(form.emailAddress,form.f > irstName,f > orm.lastName) /> > > Or is this considered better? > > <cfset variables.fNames = structNew() /> > > <cfset variables.fNames.emailAddress = form.emailAddress /> > <cfset variables.fNames.firstName = form.firstName /> > <cfset variables.fNames.lastName = form.lastName /> > > <cfset variables.createOrder = > application.vantage2DS.customerExists(variables.fNames) /> > > > I know both work, I have kind of gotten used to using getters and > setters with an event bean in Mach-II but the application I'm > working on > now I'm not using Mach-II and to my knowledge cfc's don't > have anything > like an event bean. > > Thanks, > Ben > > > ---------------------------------------------------------- > 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]
