View comments | RSS feed

Best practices for Flash forms

The following sections describe best practices that can help you increase the performance of Flash forms.

Minimizing form recompilation

Flash forms are sent to the client as SWF files, which ColdFusion must compile from your CFML code. The following techniques can help limit how frequently ColdFusion must recompile a Flash form.

Caching data in Flash forms

The cfform tag timeout attribute specifies how many seconds ColdFusion retains Flash form data on the server. When a Flash form is generated, the values for the form are stored in memory on the server. When the Flash form is loaded on the client, it requests these form values from the server. If this attribute is 0, the default, the data on the server is immediately deleted after the data has been requested from the Flash form.

A Flash form can be reloaded multiple times if a user displays a page with a Flash form, goes to another page, and uses the browser Back button to return to the page with the form. This kind of behavior is common with search forms, login forms, and the like. When the user returns to the original page:

If your form data contains sensitive information, such as credit card numbers or social security numbers, you should leave the timeout set to 0. Otherwise, consider setting a timeout value that corresponds to a small number of minutes.


ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting

Version 7

Comments


jrunrandy said on Feb 16, 2005 at 10:43 AM :
Please pay attention to the points under "Minimizing form recompilation". Form recompilation is a relatively expensive process, so you want to do this only when necessary. In particular, observe the first point: Data should be the only thing that changes. If you change anything else, you force a recompile for every user that encounters changed data. For example, if you use a label to display the individual user name, every users hits a recompile.
GregK said on Mar 2, 2005 at 7:46 AM :
The statement "When a Flash form is generated, the values for the form are stored in memory on the server." is unclear about the scope of values stored in memory. Are they global for the server, application scope, session scope, some other scope? Also, can many users that may use a form to display different data in the form benefit from caching?
jrunrandy said on Mar 7, 2005 at 4:53 PM :
The caching is not in one of the CF scopes, Each form delivered to a user wil get a unique ID which links to the cached values for that user. As long as only the form values change, all of the users will get the same movie from the cache.
jrunrandy said on Mar 11, 2005 at 8:13 AM :
Good question. The SWFs that are generated for Flash forms contain the entire Flex app model, so even if you have just two fields, the SWFs aren't small. That said, 260K seems large. You might try posting this question to the online forums to see what other developers are encountering: http://webforums.macromedia.com/coldfusion or click the Forums link on any CFMX 7 LiveDocs page.
mindtrap said on Apr 7, 2005 at 2:30 PM :
In regards to storing the form data in the server's memory. Does flash update the field data to the server on the onUnload event or does flash repeatedly update the server at each keystroke.

Also, I'm assuming that if a user has two browers open to the same form, the values won't interfere with each other.
jrunrandy said on Apr 19, 2005 at 2:44 PM :
mindtrap,
I asked a developer and this is what he said:
***
Flash doesn't update the server. When the CFML is run these form values are stored in memory and once the form is loaded the values are retrieved once (then disposed of on the server). At this point the form is loaded and the values are all on the client. Until the form is posted there is no more client/server interaction.

And yes they won't interfere with each other; both get their own cached version of the form values.

Also, on this thread I noticed another posting about the cfform.swc file size. That is a fixed size that won't change. But it's only downloaded once, and then cached in the users browser cache. Once this is cached each cfform instance is only about 15k in size (this is why we have to swf, so the large part is cached).
****
ASandstrom said on Aug 1, 2005 at 8:25 AM :
As indicated in the reference documentation (http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000256.htm
), the timeout value is in seconds.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00001408.htm