On 10/17/07, erik tom <[EMAIL PROTECTED]> wrote:
> I need to rewrite the code so it looks like a function
the actual answer will vary depending on how the function is
stored/used (e.g. is it in a CFC?)
<cffunction name="myFunction" output="false" returntype="any">
<cfargument name="myForm" type="struct" required="true" />
<cfargument name="schoolcode" type="string" required="false" default="" />
<cfset var i = "" />
<cfset var thisCheckbox = "" />
<cfset var returnMsg = "all is good" />
<cfif NOT structIsEmpty(arguments.myForm)>
<cfcontent type="text/xml; charset=UTF-8" reset="yes" />
<cfloop list="#arguments.myForm.categoryname#" index="i">
<cfset thisCheckbox = i />
<cftry>
<cfstoredproc procedure="addCategory" datasource="#arguments.dsn#">
<cfprocparam type="in" cfsqltype="cf_sql_varchar"
value="#thischeckbox#" />
<cfprocparam type="in" cfsqltype="cf_sql_varchar"
value="#arguments.schoolcode#" />
<cfprocparam type="in" cfsqltype="cf_sql_bit"
value="#arguments.myForm.hidden#" />
</cfstoredproc>
<cfcatch>
<cfset returnMsg = "There is a database error!" />
</cfcatch>
</cftry>
</cfloop>
<cfelse>
<cfset returnMsg = "form was empty" />
</cfif>
<cfreturn returnMsg />
</cffunction>
<!--- call it --->
<cfoutput>#myFunction(form)#</cfoutput>
--
Charlie Griefer
================================================
"...All the world shall be your enemy, Prince with a Thousand Enemies,
and whenever they catch you, they will kill you. But first they must catch
you, digger, listener, runner, prince with a swift warning.
Be cunning and full of tricks and your people shall never be destroyed."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion is delivering applications solutions at at top companies
around the world in government. Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291351
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4