Skip to main content
Inspiring
September 18, 2008
Question

Passing form data to CFC

  • September 18, 2008
  • 6 replies
  • 8995 views
Is there a way to just pass the form structure to a CFC without breaking it down into each field?
This topic has been closed for replies.

6 replies

Inspiring
September 19, 2008
Alternatively, one could create an object and then call the functions.
Inspiring
September 19, 2008
Dinghus wrote:
> I already have it instantiated so I guess I have to go with the structure as a whole or reinvoke it.

That is a *VERY* common misinterpretation of the usage of the
<cfinvoke...> tag, that is can not be used with an already instantiated
component.

<cfinvoke component="path.to.my.compoent"...> instantiates a component.

<cfinvoke componet="#myInvokedComponentVariable#"...> works with an
already instantiated component.



Inspiring
September 19, 2008
I already have it instantiated so I guess I have to go with the structure as a whole or reinvoke it.
Inspiring
September 18, 2008
Ian Skinner wrote:
> Dinghus wrote:
>> Is there a way to just pass the form structure to a CFC without
>> breaking it down into each field?
>
> Yes...Do you want it is a single structure in the CFC or have ColdFusion
> break it down into arguments automatically for you?
>
> Former:
> myCFC.aFunction(form)
>
> OR
>
> <cfinvoke componet="#myCFC#" anArgument="#form#" method="aFunction"/>
>
> OR
>
> <cfinvokde component="#myCFC# methode="aFunction"/>
> <cfinvokeArgument name="anArgument" value="#form#">
> </cfinvoke>
>
> Latter:
>
> <cfinvoke component="#myCFC# argumentCollection="#form#"
> method="aFunction/>
>
Inspiring
September 18, 2008
Oops forgot this one to pass in the form structure as a single argument.

myCFC.aFunction(anArgument=form)

Inspiring
September 18, 2008
Dinghus wrote:
> Is there a way to just pass the form structure to a CFC without breaking it down into each field?

Yes...Do you want it is a single structure in the CFC or have ColdFusion
break it down into arguments automatically for you?

Former:
myCFC.aFunction(form)

OR

<cfinvoke componet="#myCFC#" anArgument="#form#" method="aFunction"/>

OR

<cfinvokde component="#myCFC# methode="aFunction"/>
<cfinvokeArgument name="anArgument" value="#form#">
</cfinvoke>

Latter:

<cfinvoke component="#myCFC# argumentCollection="#form#" method="aFunction/>