Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ColdFusion redirect after processing

Posted on 2008-06-11
7
Medium Priority
?
660 Views
Last Modified: 2013-12-24
Currently I have the below page that processes the selections a user picks to add to their agenda.  Right now the page tells the user what companies were added and if any were duplicates.  Somehow I need the page to still do that processing, but rather than show them the results after the page processes I need to take them back to the previous page they were viewing so they can continue to add more companies.


<!--- This is the Action page --->
 
 
<cfif IsDefined('FORM.Login')>
	    <cfinvoke component="Components.AgendaPlanner"
				  method="getLogin"
				  argumentcollection="#FORM#">
		</cfinvoke>
</cfif>
 
<cfif IsDefined('URL.ExhibitorID')>
	<cfset Exhibitors = URL.ExhibitorID>
</cfif>
<cfif IsDefined('FORM.Customer_ID')>
	<cfset Exhibitors = FORM.Customer_ID>
</cfif>
 
<!--- <cfdump var="#variables#"> --->
<style type="text/css">
<!--
.style2 {color: #990000}
-->
</style>
 
 
<table cellpadding="0" cellspacing="0" width="700" border="0">
 
<tr align="left">
<td width="700" valign="top">  <table width="100%" border="0" cellspacing="0" cellpadding="10">
    <tr>
      <td align="left" valign="top">
  <h1>Agenda Planner</h1>
  <br />
  <br />
  <!---<cfset COOKIE.AgendaUser = 1>--->
<cfif IsDefined('Exhibitors')>
  <!---<cfoutput>#URL.ExhibitorID#</cfoutput>--->
    <cfif Not IsDefined('COOKIE.AgendaUser')>
      <cfset SESSION.WaitingAgendaListing = Exhibitors>
      <cflocation addtoken="no" url="agenda-login.cfm">
      <cfelse>
	    <cfinvoke component="Components.AgendaPlanner"
				  method="getUser"
				  returnvariable="User">
		    	  <cfinvokeargument name="UserID" value="#COOKIE.AgendaUser#">
		</cfinvoke>
      <cfif User.RecordCount NEQ 0>
 
<!---		<cfinvoke component="Components.AgendaPlanner"
	   			  method="getSavedAgenda"
	   			  returnvariable="AgendaCheck">
				  <cfinvokeargument name="Sort" value="1">
				  <cfinvokeargument name="Exhibitors" value="#Exhibitors#">	
		 		  <cfinvokeargument name="UserID" value="#COOKIE.AgendaUser#">	 
		 </cfinvoke>
     <cfif AgendaCheck.RecordCount EQ 0>--->
     
     
		<cfinvoke component="Components.AgendaPlanner"
			 	  method="insertAgendaItem"
				  returnvariable="Exhib">
			  	  <cfinvokeargument name="Exhibitors" value="#Exhibitors#">		
				  <cfinvokeargument name="UserID" value="#User.UserID#">	
		</cfinvoke>
 
 
 
       <!--- <cfdump var="#Exhib#">--->
        <cfoutput>
        <cfif len(Exhib.Inserted) NEQ 0>
        <p> <b>The following companies have been added:</b></p>
        <dl>
        <cfloop list="#Exhib.Inserted#" index="i">
        		<cfinvoke component="Components.Exhibitors"
				  method="getExhibitor"
				  returnvariable="gotExhibitors">
				  <cfinvokeargument name="ExhibitorID" value="#i#">
		</cfinvoke>
        <dd>#gotExhibitors.CO_Name#</dd>
        </cfloop>
        </dl>
        </cfif>
        <cfif len(Exhib.Duped) NEQ 0>
        <p class="style2"> The following companies are already in your agenda:  </p>
        <dl>
        <cfloop list="#Exhib.Duped#" index="i">
        		<cfinvoke component="Components.Exhibitors"
				  method="getExhibitor"
				  returnvariable="gotExhibitors">
				  <cfinvokeargument name="ExhibitorID" value="#i#">
		</cfinvoke>
        <dd>#gotExhibitors.CO_Name#</dd>
        </cfloop>
        </dl>
        </cfif>
        </cfoutput>
        <br />
        <br />
        <p class="bodytext"><a href="my-agenda.cfm">View your current agenda.</a></p>
 
        <cfelse>
        User Not Found.<cfdump var="#COOKIE#">
        </cfif>
      </cfif>
<cfelse>
    
  
  <cfif IsDefined("COOKIE.APEmail")>
    <cfset email = COOKIE.APEmail>
  <cfelse>
    <cfset email = "">
  </cfif>
  <cfif IsDefined("COOKIE.APPassword")>
    <cfset password = COOKIE.APPassword>
  <cfelse>
    <cfset password = "">
  </cfif>
  <cfform action="agenda-planner.cfm" method="post">
  <table cellspacing="0" cellpadding="2" border="0" width="400" align="center">
  <tr>
  <td class="bodytext" align="right"><b>Email Address:</b>&nbsp;</td>
  <td class="bodytext"><cfinput type="text" 
							  name="Email" 
							  size="40" 
							  maxlength="200" 
							  value="#email#"
							  required="Yes"
							  message="Email Address is a required field."></td>
  </tr>
  <tr>
  <td class="bodytext" align="right"><b>Password:</b>&nbsp;</td>
  <td class="bodytext"><cfinput type="password" 
							  name="Password" 
							  size="20" 
							  maxlength="50" 
							  value="#password#"
							  required="Yes"
							  message="Password is a required field."></td>
  </tr>
  <tr>
  <td class="bodytext">&nbsp;</td>
  <td class="bodytext"><input type="Checkbox" name="SetCOOKIEs" value="1">&nbsp;Remember my E-mail address and Password</td>
  </tr>
  <tr>
  <td class="bodytext">&nbsp;</td>
  <td class="bodytext"><input type="hidden" name="Login" value="1"><input type="submit" value="Submit" alt="Login"></td>
  </tr>
  </table>				
  </cfform>
</cfif>
        
        
        
   
        
        <p class="bodytext"></p></td>
    </tr>
  </table></td>
</tr>
</table>
<cf_2008FELFooter>

Open in new window

0
Comment
Question by:Albee_J
[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
  • 4
  • 2
7 Comments
 
LVL 36

Accepted Solution

by:
SidFishes earned 2000 total points
ID: 21761783
at the end of your processing code

<cflocation url="previouspage.cfm" addtoken="no">
0
 
LVL 4

Expert Comment

by:msfletch
ID: 21762074
What Sid said is the easiest if you don't need to display the results in your previous page or if you save the results in some type of session variables. If you want to send results to the previous page, you can try submitting a hidden form back onLoad:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>Processing Results</title>
</head>
<body onLoad="document.form.submit();">
<form name=form method=post action="previousPage.cfm">
    <input type=hidden name="value1" value="someValue">
    <input type=hidden name="value2" value="someValue">
    <input type=hidden name="value3" value="someValue">
</form>
</body>
</html>

... or adding name/value pairs to the URL Sid suggested:

<cflocation url="previouspage.cfm?value1=somevalue&value2=somevalue&value3=somevalue" addtoken="no">
0
 

Author Comment

by:Albee_J
ID: 21762109
I added  <cflocation url="#CGI.HTTP_REFERER#" addtoken="no">  but there is too much going on (checking to see if there is dupes etc)to add that to the current page, its not working correctly.  Either that or I am just not adding it in the right place.
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 4

Expert Comment

by:msfletch
ID: 21762738
You could also try:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>Processing Results</title>
</head>
<cfoutput>
<body onLoad="window.location='#CGI.HTTP_REFERER#'">
</cfoutput>
</body>
</html>
<cfabort>
0
 
LVL 4

Expert Comment

by:msfletch
ID: 21762772
Or this:

<cfset getpagecontext().getResponse().sendRedirect('#CGI.HTTP_REFERER#')>

It's an alternative to cflocation it uses the underlying JVM
0
 
LVL 4

Expert Comment

by:msfletch
ID: 21762791
0
 

Author Comment

by:Albee_J
ID: 21762926
msfletch:

When I try GetPageContext()  I get a Virtual Directory error.  
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

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 …
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
Suggested Courses

610 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