5 Replies Latest reply on May 9, 2007 9:57 PM by Newsgroup_User


    ssailer Level 1
      This is probably a stupid question, but I am fairly new to Components. If I am defining all of my queries within a component, how do I then drag and drop values to form fields on my .cfm page (after using the INVOKE tag) using the bindings panel, like when you create the query on the same .cfm page as your code is going to reside on? What am I missing? I can't believe there is not a way to do this other than having to go into the code and define each and every field value manually. Thanks for any help in this matter!
        • 1. Re: CFCs
          If you return a query from the component, then you can just set a variable to be the returnvariable and then use it as you would a query variable.

          For example: <cfinvoke component="testComponent" method="getMethod" returnvariable="qryReturnQuery" componentargument="#testArgument#">

          I'm a little confused on what you're asking, but I hope this helps.
          • 2. Re: CFCs
            ssailer Level 1
            I know I'm being confusing :) Okay - let me try to simplify this. If I create an update form on editRecord.cfm, using Dreamweaver, and place the query that populates the form values at the top of editRecord.cfm, I can then bind the values to the form fields using Bindings panel by dragging the field name in my recordset to the form field. Now, if I create a CFC called employees.cfc and place my query within a <cffunction> tag, when I go back to my document to populate the form values from the query, that query is no longer available to me in the Bindings panel on editRecord.cfm. I hope I'm making sense this time...
            • 3. Re: CFCs
              amers Level 1
              ssailer, I'm not sure if I'll be able to describe this the way you're doing this. I've only use the code side of things when developing pages that use CFC's and Queries. It sounds like you're doing this from the design view. From the code perspective, you'd do something like this:

              <cfinvoke component="<component name>" method="<method name - that would be the function with the query>" returnvariable="<whatever you want to name the return variable - i.e. myQuery>">

              <form name="testForm" method="post">
              <input name="firstname" value="#myQuery.firstname#">
              • 4. Re: CFCs
                ssailer Level 1
                Okay - it sounds as if you can't do what I'm describing when you use the queries inside of a CFC. I use both the code and design view - which ever one is faster for what I need to get done.
                • 5. Re: CFCs
                  Level 7
                  from adobe dw9 (cs3) livedocs:
                  (same applies to dw8)

                  Use a CFC recordset as a source of dynamic content

                  You can use a ColdFusion component (CFC) as a source of dynamic content
                  for your pages if the component contains a function defining a recordset.

                  Note: This feature is available only if you have access to a computer
                  running ColdFusion MX 7 or later. For more information, see Enable the
                  ColdFusion enhancements.

                  1. Open a ColdFusion page in Dreamweaver.
                  2. In the Bindings panel (Window > Bindings), click the Plus (+) button
                  and select Recordset (Query) from the pop‑up menu.
                  The Recordset dialog box appears. You can work in either the simple
                  or the advanced Recordset dialog box.
                  3. Click the CFC Query button.
                  4. Complete the CFC query dialog box, click OK, and then click OK again
                  to add the CFC recordset to the list of available content sources in the
                  Bindings panel.
                  5. Use the Bindings panel to bind the recordset to various page elements.

                  http://livedocs.adobe.com/en_US/Dreamweaver/9.0/WScbb6b82af5544594822510a94ae8d65-786d.htm l


                  Azadi Saryev