6 Replies Latest reply on Sep 19, 2008 11:12 AM by Dan Bracuk

    Passing form data to CFC

    Dinghus Level 1
      Is there a way to just pass the form structure to a CFC without breaking it down into each field?
        • 1. Re: Passing form data to CFC
          Level 7
          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/>

          • 2. Re: Passing form data to CFC
            Level 7
            Oops forgot this one to pass in the form structure as a single argument.

            myCFC.aFunction(anArgument=form)

            • 3. Re: Passing form data to CFC
              Level 7
              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/>
              >
              • 4. Re: Passing form data to CFC
                Dinghus Level 1
                I already have it instantiated so I guess I have to go with the structure as a whole or reinvoke it.
                • 5. Re: Passing form data to CFC
                  Level 7
                  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.



                  • 6. Re: Passing form data to CFC
                    Dan Bracuk Level 5
                    Alternatively, one could create an object and then call the functions.