Solved

Return to page it came from

Posted on 2013-10-29
3
244 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 28

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
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 …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now