Coldfusion MX version 7 gives us a great new feature when using <CFFORM>. It renders the forms in a flash form. The look is clean and the result is well behaved and intuitive. We've had a lot of fun creating prototypes using flash form grids and the accordian pane or tabbed interface. It's great to be able to create a form with tabs that doesn't require round trips to the server and has solid validation routines. Along the way we hit a couple of challenges and came up with a few solutions ....p>One of the frustrations we have is that the full universe of actionscript is not available to us. There are times when we want more granular control over the elements that are contained within a server-generated form. The only thing you can do is to add scriptlets to the event handlers for particular form elements. Why is this frustrating you ask? One of the problems we tried to solve is providing a preview of data that is dynamically populated as the user is filling out the form. This is important on a complex form where the data is related.
In our case we simply wanted to update a text area with information related to user choices and helpful hints and clues as to how they are doing. This is possible in the flash form using a text area or (I suppose) a cfformitem and manipulating the value attribute. Neither approach was ideal because it's difficult to write complex actionscript commands inside the handlers. For example, MM in their wisdom removed the "new" key word so you cannot create any "new" object.
One solution that I thought was cool enough to mention was the shared object solution. We created a flash movie that has a visible text area nicely formatted. We added code to the move that polled a shared object periodically and updated the text field. Yes, I know the localConnection object would be much better for this, but since I can't use new in the flash form actionscript I cannot create the connection object on that side (sigh). sharedObject() doesn't require a "new" keyword however so we can use it. Here's the code we used for the polling object (1 time per second).
On the flash form it's a little tricker. To get the actionscript necessary into shared object we have to run the following code: