Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Passing form data to CFC

Contributor ,
Sep 18, 2008 Sep 18, 2008
Is there a way to just pass the form structure to a CFC without breaking it down into each field?
TOPICS
Advanced techniques
9.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 18, 2008 Sep 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/>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 18, 2008 Sep 18, 2008
Oops forgot this one to pass in the form structure as a single argument.

myCFC.aFunction(anArgument=form)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 18, 2008 Sep 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/>
>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 19, 2008 Sep 19, 2008
I already have it instantiated so I guess I have to go with the structure as a whole or reinvoke it.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 19, 2008 Sep 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.



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 19, 2008 Sep 19, 2008
LATEST
Alternatively, one could create an object and then call the functions.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources