The cfform preservedata attribute tells ColdFusion to continue displaying the user data in a form after the user submits the form. Data is preserved in the cfinput, cfslider, cftextinput, and cftree controls and in cfselect controls populated by queries. If you specify a default value for a control, and a user overrides that default in the form, the user input is preserved.
You can retain data on the form when the same page contains the form and the form's action code; that is, the form submits to itself. You can also retain the data if the action page has a copy of the form, and the control names are the same in the forms on both pages. (The action page form does not need to be identical to the initial form. It can have more or fewer elements than the initial page form; only the form elements with identical names on both pages keep their data.)
For example, if you save this form as preserve.cfm, it continues to display any text that you enter after you submit it, as follows:
<cfform action="preserve.cfm" preservedata="Yes"> <p>Please enter your name: <cfinput type="Text" name="UserName" required="Yes"><p> <input type="Submit" name=""> <input type="RESET"> </cfform>
Usage notes for the preservedata attribute
When you use the preservedata attribute, follow these guidelines: