9 Replies Latest reply on Feb 16, 2010 10:12 AM by TiGGi

    cfselect bind to CFC in a flash formatted form


      Oh man, I've googled this thing to death, searched the forums, tried numerous trial-error routines and I'm still at a loss.  The goal is to create a cfform with format="flash" and use CF 8's inbuilt Ajax binding to have the cfselect populated by execution of a CFC running queries.  Essentially, this will be expanded as the form is much more complex than just a single cfselect.  A selection made on one list will drive the options available on another list, triggering updates to other text fields, etc. This along with CFChart are two huge features I used to sell my managers on investing in CF over ASP.net (rich Flash forms with built-in Ajax capabilites, CFChart for visual presentation of data, etc.)  Managers love that stuff...


      At a fundamental level though,  I cannot get this dumb thing to push data from the CFC back to the cfselect while using cfform format="flash".  At this point I'm convinced it's a simple typo or I'm missing an attribute on the cfselect, or... I've gone completely mad.


      Test case #1:

      If I change the cfform's attribute to format="html" then the cfselect appears with options, the CF Ajax debugger shows the Ajax conversation, and Firebug shows the same Ajax data.  If I change it to format="flash" I get no options in the cfselect and no Ajax conversation.  I even removed my query from the CFC and used the demo cfartgallery DB built into the CF Server, just to eliminate that as a potential issue.  I tried adding the attribute value="column-name from query" in the cfselect, just to test, still nothing.  In the CFC I've also tried altering the returnType="any" in the cffunction, tried specifying returnFormat="json", and also tried adding <cfreturn serializeJSON(data)>  instead of <cfreturn data> still with no luck.  What am I breaking or what am I missing here?  For the love of everything holy I hope someone out there can point me in the right direction, I'm willing to have egg on my face for anything stupid!!


      Test case #2:

      If I remove the CFC from the equation all together- put the cfquery in the same template as the cfform code, cfform is format="flash" and on the cfselect control specify the attribute query="data" and value="mediaid" then the query results drive the population of the cfselect's options.  Obviously there is no ajax activity here.  If I toggle cfform format="html" still all is well.  This doesn't really satisfy the goal though, trying to build the application using clean, CFC modular approach.  Layering a bunch of queries and presentation logic into one template is sloppy and won't help me utilize the dynamic benefits of Ajax.


      The code for test case #1 is:

      c.cfm template is:




      format="flash" method="post" action="c.cfm?cfdebug" skin="haloOrange" id="theform"> <!---toggle format="html" and it works, flash doesn't, grrr--->


      <cfformgroup type="panel" width="200" label="Enter">



      <cfselect width="100" name="oClientSelect" display="mediatype" bind="cfc:c.getClientList()" bindOnLoad="true" label="Stuff:" id="oCFSelect" />






      <cfinput type="submit" name="btn" value="Submit">



      c.cfc template is:






      <cffunction name="getClientList" access="remote" returntype="Any">



      <cfquery name="data" datasource="cfartgallery">



      SELECT mediaid, mediatype


      FROM media


      ORDER BY mediatype




      <cfreturn data>






      The code for test case #2 is:

      (just for grins... no point to me posting this code, other than neato the dumb cfselect really does work...)

      no cfc and c.cfm template is:




      name="data" datasource="cfartgallery">



      SELECT mediaid, mediatype


      FROM media


      ORDER BY mediatype






      format="html" method="post" action="c.cfm?cfdebug" id="theform"> <!---toggle format="html" or format="flash" freely without issue--->



      <cfformgroup type="panel" width="200" label="Enter">




      <cfselect width="100" name="oClientSelect" query="data" display="mediatype" value="mediaid" label="Stuff:" id="oCFSelect" />








      <cfinput type="submit" name="btn" value="Submit">



      Any help would be so incredibly appreciated!!!

        • 1. Re: cfselect bind to CFC in a flash formatted form
          TiGGi Level 1

          Your code looks fine to me, not sure about the "display" tag.  It's not needed and I am not sure if it's causing the error.  Try removing tags from your select that aren't required.

          <cfselect name="oClientSelect" bind="cfc:c.getClientList()" bindOnLoad="true" />


          Also do you have cf connector added to this site?  You should have CFIDE virtual directory in your site.

          • 2. Re: cfselect bind to CFC in a flash formatted form
            BSmithATL Level 1

            Hello TiGGi,

            Thanks so much for your reply!  I changed my cfselect tag to



            name="oClientSel" bind="cfc:c.getClientList()" bindOnLoad="true"/>


            Still no luck I verified that all IIS virtual directories exist (JRunScripts, CFIDE, cfdocs), verified that I can get into the CF Server Admin, etc.  I set NTFS permissions on c:\inetpub\wwwroot and all child files & dirs to Everyone.  I've tried using IE and Firefox.  I even moved my test files application.cfm, c.cfc and c.cfm to the web root, instead of \_test\ subdir, just for the heck of it.  Still no luck.  I downloaded a Dev version of ColdFusion 9, installed that on a different box, configured it, same result.  I stopped all IIS services, stoped all CF services, restarted them, same result.


            cfform format="Flash" 'looks like this:



            For HTML formatted form, the CFSelect tag has to have the Display attribute with a value, so my cfselect in this example is:



            name="oClientSel" bind="cfc:c.getClientList()" bindOnLoad="true" display="mediatype">






            cfform format="HTML"  looks like this:



            I'm telling you, this is such a weird problem!  I just cannot figure out what the deal is!


            I'm going to experiment with CFGrid and see if the problem follows all flash controls or just CFselect.  I'm almost tempted at this point to try to get ahold of the Flash studio and try to mess with actionscript and Flash remoting and #$%@ this built-in Flash form nonsense

            • 3. Re: cfselect bind to CFC in a flash formatted form
              TiGGi Level 1

              I tried your example and I was getting the same empty select.  However I was able to populate it using query tag in cfelsect.


              <cfselect width="100" name="oClientSelect"  query="data" value="categoryid" display="categoryname" label="Stuff:" id="oCFSelect" />


              I am gonna go back and see if I can get the bind working.

              • 4. Re: cfselect bind to CFC in a flash formatted form
                BSmithATL Level 1

                Ok, glad you are able to reproduce this, so I'm not going totally crazy, just 50% 


                I'll keep trying too.  I cannot imagine that we are the first people to try this, this binding has been around for a while now.  If we are the first to get this set of circumstances together which creates this issue, I'll be really surprised.

                • 5. Re: cfselect bind to CFC in a flash formatted form
                  TiGGi Level 1

                  I am sure I've done this before just don't rmember on what project.  Another possibility for you to keep using cfc is do something like this,


                  data = createObject("component","c").getClientList();


                  <cfform format="flash" height="200" >
                  <cfselect width="100" name="myselect" query="data" display="mediatype" value="mediaid"/>

                  • 6. Re: cfselect bind to CFC in a flash formatted form
                    BSmithATL Level 1

                    Well TiGGi, I have some bad news the great Forta has spoken:


                    http://forums.forta.com/messages.cfm?threadid=6C755C09-C80A-334E-A9A035956570E1B4&page=1&# 3


                    If he won't test it and he's pretty sure it won't work, then I guess that's our answer   I posted yesterday and got a response this morning.  I guess I'll start heading down the Flex path instead of wiring up the CF Server's rendered flash forms and writing flash remoting code.  I did find this example yesterday which does the trick http://www.asfusion.com/blog/entry/how-to-populate-a-cfselect-with-flash but if Ben says the same thing can be done faster in Flex then I'll give it a shot.

                    • 7. Re: cfselect bind to CFC in a flash formatted form
                      TiGGi Level 1

                      have you tried using query="data" ssolution again or is this something that you do not want to do?

                      • 8. Re: cfselect bind to CFC in a flash formatted form
                        BSmithATL Level 1

                        Hey TiGGi, yes your example is still a good option, I'll probably just go with that for now until I research Flex 3 and get my arms wrapped around that.  Have you done anything with Flex?  I just hate having to go buy more software after I just managed to get CF Server 8 Standard and a bunch of books paid for.  Now if I say "will you buy Flex 3" and "in a few months buy Flex 4" I'm going to start losing credibility So your technique and/or this technique http://www.asfusion.com/blog/entry/how-to-populate-a-cfselect-with-flash  I believe will at least get the project off the ground.  Thanks for your continued postings!

                        • 9. Re: cfselect bind to CFC in a flash formatted form
                          TiGGi Level 1

                          Sorry for being able to help you more.  Flex is open source framework and you do not need to get any new software.  It will work with coldfusion 8  as it is. I have done some stuff with flex but not much on my own.  Good source of examples is http://www.asfusion.com/ and http://flex.org.  You might even be able to find your solution there.