Skip to main content
Inspiring
January 10, 2013
Question

Cflocation or page redirects

  • January 10, 2013
  • 3 replies
  • 1526 views

I have a page that edits a database called (edit_record.cfm). The link from page A will go to the edit page that will allow for changes. After the update to the database from the (update_record.cfm), my cflocation tag will go back to page A. However right before I submit my finished records to my manager on my (email_review.cfm) page, I can click on each record to edit one last time. which when clicked would go to the same (edit_record.cfm).

What i want to do is to have a have my cflocation go to any of my previous pages when my database updates regardless if the previous page is my (edit_record.cfm) or (email_review.cfm)

    This topic has been closed for replies.

    3 replies

    Tim Cunningham
    Participating Frequently
    January 10, 2013

    If you want it to return to the page that called it try this:

    <cflocation url="#cgi.http_referer#>

    the referer is the page that called your current page.

    Tim Cunningham
    Participating Frequently
    January 10, 2013

    if you dump the <cfdump var="#cgi#"> you will find all sorts of goodies in there.

    Inspiring
    January 10, 2013

    Regarding, "What i want to do is to have a have my cflocation go to any of my previous pages"

    You can't.  You have to go to a specifc page.  If there is conditional logic involved, that's a different story.  Also, if you want to pick a previous page at random, that's also possible although it seems rather silly.

    WolfShade
    Legend
    January 10, 2013

    When either edit_record.cfm or email_review.cfm loads, set an input type="hidden" field called "returnTo" and give it a value of #cgi.script_name#.  After the database stuff, CFLOCATION to that form field value.

    ^_^