Solved

Return to page it came from

Posted on 2013-10-29
3
247 Views
Last Modified: 2013-10-31
Hi Guys,

I have a header that shows on every page of a site that contains a form that submits to a 'process.cfm' page.

How do I do it such that wherever the header form is submitted from, after the form data gets submitted to the 'process.cfm' page, it returns back to its original page address that submitted it?

I know to use a cflocation tag on the 'process.cfm' page, but how do I get the page url address(including any URL parameters) that the form is coming from so that I can input it into the cflocation tag?(plan to save the page URL address in a hidden form field on the header form page and plug that into the cflocation tag)



Thanks :)
0
Comment
Question by:CFbubu
3 Comments
 
LVL 29

Assisted Solution

by:becraig
becraig earned 100 total points
ID: 39610232
This is the value you need:
<cfoutput>#cgi.HTTP_REFERER#</cfoutput>
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 400 total points
ID: 39610245
I would not rely on the referrer variable for your site; you could pass the return url

To me, the preferred way of doing this would be to post each form page to ITSELF and just CFINCLUDE the processing page at the top of each form page.   This has many advantages, although the processing (database actions) may be done in your process.cfm file, you still have individual control in your form file.   So, after the processing you can then redirect to a different page; this can vary for each form file rather than being locked to an action in your process.cfm page.   But most of all.. what if there is an error?   Your form page catches the error and you simply show the form again, with all values still in their fields, even though you have not saved them (due to the error).
0
 

Author Closing Comment

by:CFbubu
ID: 39614652
Thanks gdemaria and becraig.

gdemaria's answer provided a great deal of clarity to what is the best practice to tackle such an issue.

Thank you for all your trouble providing so much thought into your answer. :)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question