Adobe COLDFUSION 9 Manual page 787

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
<cfformgroup type="vbox" name="buttons"style="verticalAlign:bottom;
horizontalAlign:center">
<!--- Use a spacer to position the buttons. --->
<cfformitem type="spacer" height="18" />
<!--- Use the insertRow method in the onClick event to add a row. --->
<cfinput type="button" name="ins" value="Insert a new row" width="125"
onClick="GridData.insertRow(mygrid);">
<!--- Use the deleteRow method in the onClick event to delete
the selected row --->
<cfinput type="button" name="del" value="Delete selected row"
width="125" onClick="GridData.deleteRow(mygrid)">
<cfinput type="submit" name="f1" value="Submit" width="125">
</cfformgroup>
</cfformgroup>
</cfform>
<!--- Dump the form if it has been submitted. --->
<cfif IsDefined("form.fieldnames")>
<cfdump var="#form#"><br>
</cfif>
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"
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
tag
attribute specifies how many seconds ColdFusion retains Flash form data on the server.
cfform
timeout
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
value is 0, or the time-out period has expired, the data is no longer available, and ColdFusion returns
timeout
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.
if you must loop no more than ten times over no more than ten elements.
Last updated 8/5/2010
782

Advertisement

Table of Contents
loading

Table of Contents