Solved

Return to page it came from

Posted on 2013-10-29
3
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 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