Just build your form validation inside of your CFC, or have it call a validate() function inside your updateTable function before dumping right to the database, and don't forget your should replace:
Field1='#arguments.Field1#' With this: Field1 = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.Field1#" /> Chris -----Original Message----- From: Chad Gray [mailto:[EMAIL PROTECTED] Sent: Thursday, June 07, 2007 12:36 PM To: CF-Talk Subject: RE: invoking a cfc function with minimal typing Wow... that is really great! Talk about minimal typing! This use of argumentcollection=form. What are the dangers? It seems too easy to use. -----Original Message----- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, June 07, 2007 11:38 AM To: CF-Talk Subject: Re: invoking a cfc function with minimal typing if you're sending form fields... <cfset myInstance.updateTable(argumentcollection=form) /> you can send an array, you can send a struct... you can send any number of simple variables wrapped up in a single complex var. On 6/7/07, Chad Gray <[EMAIL PROTECTED]> wrote: > I have a function in a CFC that does an update on a database table. > > <cffunction name="updateTable" access="public"> > <cfargument name="id" type="numeric" required="yes"> > <cfargument name="Feild1" type="string" required="no"> > <cfargument name="Field2" type="string" required="no"> > > <cfquery datasource="#variables.dataSource#"> > UPDATE table SET > Field1='#arguments.Field1#', > Field2='#arguments.Field2#' > WHERE id = #arguments.id# > </cfquery> > </cffunction> > > > I can use <cfinvoke> with cfinvokearguments tags for each field, but that is a lot of typing. > > What is best way to send the arguments to the function with the least amount of typing? > > I suppose is my real question is how do you use cfscript to send the data? > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Macromedia ColdFusion MX7 Upgrade to MX7 & experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280402 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4