Solved

Return to page it came from

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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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