Using Flash Forms Inside Of CF 8 Ajax Containers

A comment on Ray's post about cfgrid renderers today asked why a Flash form grid would not load inside of a cfwindow. I mentioned the reason why Flash Forms/Flex SWF's won't load without modifications previous post, but wanted to throw out a reminder in case folks may have missed it.

When working with Ajax UI elements in CF 8, if your container has any references to external JavaScript libraries they will likely not work. What some folks may not remember offhand is that Flash Forms are dependant on a few external scripts to work their magic, so including those in your main template (the one that calls the cfwindow) will get things to work properly.

Here's a quick conversion of Ray's code to a Flash format grid inside of a cfwindow. Please note that the rendering functionality that Ray blogged about will not work with the Flash grid - it is specific to the Ext grid - but this conversion just shows how it is possible to load a Flash Form in a cfwindow...

index.cfm:

<cfajaximport tags="cfform" />
<script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>
<script type="text/javascript" charset='utf-8' src='/CFIDE/scripts/cfformhistory.js'></script>
<script type="text/javascript" charset='utf-8' src='/CFIDE/scripts/CF_RunActiveContent.js'></script>

<cfwindow name="gridWin" title="grid" initShow="true" closable="true" source="win.cfm" />

win.cfm

<cfset data = queryNew("price,product")>
<cfloop from=1 to=10 index="x">
<cfset total = randRange(20,100) & "." & randRange(1,99)>
<cfset product = "Product #X#">
<cfset queryAddRow(data)>
<cfset querySetCell(data, "price", total+0, x)>
<cfset querySetCell(data, "product", product, x)>
</cfloop>

<cfform name="test" format="flash">
<cfgrid name="data" query="data" width="600">
<cfgridcolumn name="price" header="Price">
<cfgridcolumn name="product" header="Product">
</cfgrid>
</cfform>

Update: As usual - there are issues with IE 7 with this demo. I will revisit...

Comments
thanks Todd. I find the v8 livedocs are lacking a lot of interesting tidbits like this one. Hopefully as we progress the comments section will fill up on them with little things like this ;)
# Posted By Dana Kowalski | 8/20/07 10:29 PM
Hey Todd,

Great example. I never bothered to try and get the flash grid to work within an ajax container I figured the ajax grid was lighter in weight and faster to render than a flash grid.
# Posted By Gary Gilbert | 8/21/07 3:35 AM
DK: I'm sure they'll fill up shortly :)

Gary: I certainly agree with you - this was really more of a proof of concept.
# Posted By todd sharp | 8/21/07 8:37 AM
Thanks for the great post. Just wondering if the reverse is possible. Well, not exactly reverse... here is what I like to do. Bind a HTML grid to a flash tabbed form and then use a Ajax submit of the flash form, in a master-detail kind of setup. Of Course all the functions like callback, error message display, grid refresh should happen after the submit. I tried to do this and I am having trouble with the bind. Will this work at all?
# Posted By frank anthony | 8/30/07 12:46 PM
Todd, it's great to see someone talking about this! I am trying to load .swf and cfform content into a cflayoutarea (called "lowerrightbox") using the javaScript:ColdFusion.navigate('pageOne.cfm','lowerrightbox')" call from a cfmenu.
Instead of loading the content into the cflayoutarea it loads a new page with just the .swf.
I have tried adding the javascript files (that I know of) to the main page but still have no luck.
Do you know which files I should include to get this content to load?
Thanks for your help!
Cathy
# Posted By Cathy Shapiro | 10/29/07 10:18 AM
Cathy: If you shoot me your code I'd be glad to take a look at it. Email me if you'd like...
# Posted By todd sharp | 10/29/07 11:00 AM
Hi Todd, great post.
Any update on the IE7 issues?
I cannot get this to work properly in IE7.

Thanks for the update,
Wim.
# Posted By Wim | 2/1/08 5:50 AM
I copied and pasted the code exactly as above and it doesn't seem to work for me (in IE 6.03). The cfwindow opens and disappears as soon as the form loads. The form replaces the entire page.

Did I miss something?
# Posted By Patrick Stewart | 4/16/08 2:11 PM
Sorry Patrick, not sure what's up with the IE issues and I've not had the time to revisit this...
# Posted By todd sharp | 4/17/08 9:49 AM
I'm trying to put a cfchart in a cfwindow. It works in FF but IE7 throws an error and does not show the chart.

here is code:

index.cfm:

<cfajaximport tags="cfwindow">

<a href="##" onClick="ColdFusion.Window.create('theWindow', 'hasChart','chart.cfm')">Click here</a>

chart.cfm:

<cfchart>
   <cfchartseries type="pie">
   <cfchartdata value="25" item="things">
<cfchartdata value="25" item="stuff">
<cfchartdata value="50" item="shenanigans">
</cfchartseries>
</cfchart>

any suggestions would be much appreciated.
# Posted By Howard Ross | 5/15/08 6:34 PM

Calendar

Sun Mon Tue Wed Thu Fri Sat
  12345
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31   

Subscribe

Enter your email address to subscribe to this blog.

Tags

actionscript ajax blogging cfsnippets coldfusion flash forms flex misc model-glue off topic personal project learn slidesix sql

Recent Comments

More CF+Java: Compiling Classes And Persisting Objects
Getburl said: I have been attempting to get Db4o working in my CF application and I have not succeeded. I would lo... [More]

Thoughts On Ajax Frameworks And ColdFusion/Adobe
Erast said: http://fanniecollins.10gb... emo http://gracetrevino.phree...... [More]

Extending Ext With Ext Extensions
Erast said: http://fanniecollins.10gb... emo http://gracetrevino.phree...... [More]

CF Needs An Open Source Contact List Importer
Kay Smoljak said: Heh, the fact that sites DO it doesn't mean they SHOULD. To us it's ok, but to a non-tech-savvy user... [More]

A Few Project Updates
Helena said: Now punctually what is the situation ? [More]

RSS


coldfusionbloggers

FullAsAGoog MXNA

Consumed By Feed-Squirrel.com