Skip to main content
Known Participant
August 24, 2009
Question

Resetting page/browser after back button is clicked

  • August 24, 2009
  • 3 replies
  • 794 views

I have a form that contains input, radio buttons, and checkboxes. The form submits to itself instead of an action page.

After all the processing is done, I output a report using all the data that was entered. At th e end of the report, I have to do a cfabort, otherwise the form will display right after the report.

At the end of the report, I want a back button to take the user back to the form. However, the data is still on the form and I would like it cleared when they return to the form.

What would be the best way to do this ?

    This topic has been closed for replies.

    3 replies

    Inspiring
    August 27, 2009

    Hi Olivia,

    Oops

    This: <cfif IsDefined('btn_submit')>

    Should have been

    This <cfif IsDefined('form.btn_submit')>

    Leonard

    Inspiring
    August 27, 2009

    Hi Olivia,

    Try switching from a go back button process to an actual submit button process.

    Something like this.

    <cfif IsDefined('btn_submit')>

    <---

    Your display / output information here

    --->

    <cfform action="page_name.cfm" method="post" enctype="multipart/form-data" preloader="no">
    <cfinput type="submit" name="btn_new" value="New Form">
    </cfform>

    <cfelse>

    <---

    Your page / form layout here

    --->

    <cfform action="page_name.cfm" method="post" enctype="multipart/form-data" preloader="no">
    <cfinput type="submit" name="btn_submit" value="Create Report">
    </cfform>

    </cfif>

    By doing something like this, you are actually reloading the same page as

    if it was the first time viewing the page and thus your form fields should all

    be blank and ready for new information.

    Leonard

    August 24, 2009

    Try telling the browser not to cache the content. Add this to the top of the cfm:

    <cfheader name="Expires" value="Sun, 06 Nov 1994 08:49:37 GMT">
    <cfheader name="Pragma" value="no-cache">
    <cfheader name="cache-control" value="no-cache, no-store, must-revalidate">

    Good luck,

    Henry