Solved

need to go back and reload a page with one click

Posted on 2002-07-14
6
146 Views
Last Modified: 2012-06-27
Hi,

I have a coldfusion page with a server side "email this page to a friend" funcion set up on it.
So a user fills in their info and clicks the submit button.
On submit they are redirected to a page that says "your message has been sent" and on this page I have a button that allows them to go back to the "email this page to a friend" page. But when I just send them back all the info that they filled out on the email form is still there - looks tacky.
So what I'd like is to have the page reload as I send them back which would be easy except that the url is generated dynamically and never the same twice. I've been trying to use location.referrer to generate an href link but it seems to be beyond my limited skills.
Thanks for any help.

Jon
0
Comment
Question by:jonleehacker
[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
  • 2
6 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7152669
Why not use a new window pop-up for the send to friend stuff, that way you wouldn't have to worry about finding your way back.

Fritz the Blank
0
 
LVL 3

Expert Comment

by:tejaspurani
ID: 7154376
save this as
connectdb.html
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script language="JavaScript">
var qStr = location.search;
alert(qStr);
function test(){
     window.location.href = "DocumentReferr.html?id=clear";
}
</script>

</HEAD>
<BODY>
<form name="frm" method=post>
     <input type=text name=txt1><br>
     <input type=button name=conect value=conect onclick="test()">
</form>
<P>&nbsp;</P>
<script language="JavaScript">
if (qStr != ""){
     rSet();
}
function rSet(){
 if(qStr.indexOf("clear") > 1 ){
          document.frm.reset();
          }
}
</script>
</BODY>
</HTML>

save this as
DocumentReferr.html
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script language="JavaScript">
function test(){
     window.location.href = "ConnectDB.html?id=clear";
}
</script>

</HEAD>
<BODY>
<form name=frm method=post>
     <input type=button name=conect value=Back onclick="test()">
</form>
<P>&nbsp;</P>

</BODY>
</HTML>

T.P.
0
 
LVL 1

Author Comment

by:jonleehacker
ID: 7156309
T.P.

While your solution works on the pages you've done. I'm still unclear how in your

function test(){
    window.location.href = "ConnectDB.html?id=clear";

do I get my dynamically generated URL (ie: never the same twice) into where you have ConnectDB.html?id=clear. That is the whole problem. I need a way to parse out the referring page's URL and put it into a variable and then do the

function test(){
    window.location.href = "ReferrerURL_Variable?id=clear";


0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 3

Accepted Solution

by:
tejaspurani earned 50 total points
ID: 7158431
//Try This here I 'm using location.href property it
//will give u fully qualified URL then search for the file
//name and perform the action u don't need to check for
//querystring here
//connectdb.html
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script language="JavaScript">
//alert(location.href);
//var qStr = location.search;
var qStr = location.href;
alert(qStr);
function test(){
    window.location.href = "DocumentReferr.html";
}
</script>

</HEAD>
<BODY>
<form name="frm" method=post>
    <input type=text name=txt1><br>
    <input type=button name=conect value=conect onclick="test()">
</form>
<P>&nbsp;</P>
<script language="JavaScript">
if (qStr != ""){
    rSet();
}
function rSet(){
if(qStr.indexOf("ConnectDB.html") > 1 ){
         document.frm.reset();
         }
}
</script>
</BODY>
</HTML>


//Documentreferrer.html
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script language="JavaScript">
function test(){
    window.location.href = "ConnectDB.html";
}
</script>

</HEAD>
<BODY>
<form name=frm method=post>
    <input type=button name=conect value=Back onclick="test()">
</form>
<P>&nbsp;</P>

</BODY>
</HTML>
0
 
LVL 3

Expert Comment

by:tejaspurani
ID: 7163010
please comment.
T.P.
0
 
LVL 1

Author Comment

by:jonleehacker
ID: 7163459
Thanks, I got it to work!!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

623 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