On 7/11/07, Barney Boisvert <[EMAIL PROTECTED]> wrote:
>
> Most of the time when someone refers to submitting to a CFC, they're
> talking about a remoting or web services method invocation, not a form
> POST. Which isn't to say that POSTing to a CFC is bad, just that's
> not really the use case they're best suited for.
>
> cheers,
> barneyb
Not sure I believe that, if the function is set to accept form elements
then it's the way to go and handling the cflocation could be as simple as
placing that in a hidden form variable.
In your application you might have something like this...
<cfscript>
Application.CFCName = createObject("component","
LocationtoCFC.CFCName");
</cfscript>
Then in your form page you have two hooks to the application.CFCName
<cfif IsDefined('FORM.FieldName')>
<cfscript>
Application.CFCName = #FORM.Quesion1#;
Application.CFCName = #FORM.Question2#; etc...
Application.CFCName = "#FORM.ReturnPageURL#";
WhatEver = Application.CFCName.InsertName();
</cfscript>
<cfelse>
<cfform Action="#CGI.Script_Name#>
</cfform>
</cfif>
The CFC makes use of these variables in the THIS scope.
<cffunction name="InsertName">
<cfquery datasource="#Application.DSource#">
INSERT INTO table
( Question1, Question2
)
VALUES
( <cfqueryparam cfsqltype="cf_sql_varchar"
value="#THIS.Question1#">,
<cfqueryparam cfsqltype="cf_sql_varchar"
value="#THIS.Questions2#">
)
</cfquery>
<cflocation = "#THIS.ReturnPageURL#" AddToken ="False">
</cffunction>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283530
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4