Best practices for 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.

  • Only data must be dynamic. Whenever a variable name changes, or a form characteristic, such as an element width or a label changes, the Flash output must be recompiled. If a data value changes, the output does not need to be recompiled.
  • Use cfformgroup type="repeater" if you must loop no more than ten times over no more than ten elements. This tag does not require recompiling when the number of elements changes. It does have a processing overhead that increases with the number of loops and elements, however, so for large data sets or many elements, it is often more efficient not to use the repeater.

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 behavior is common with search forms, login forms, and the like. When the user returns to the original page:

  • If the timeout value is 0, or the time-out period has expired, the data is no longer available, and ColdFusion returns a data-expired exception to the browser; in this case, the browser typically tells the user to reload the page.
  • If the time-out has not expired, the browser displays the original data.If your form data contains sensitive information, such as credit card numbers or social security numbers, leave the time-out set to 0. Otherwise, consider setting a time-out value that corresponds to a small number of minutes.

Using Flash forms in a clustered environment

Flash forms require sticky sessions when used in a cluster.

Get help faster and easier

New user?