Solved

need to go back and reload a page with one click

Posted on 2002-07-14
6
140 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
  • 3
  • 2
6 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 3

Accepted Solution

by:
tejaspurani earned 50 total points
Comment Utility
//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
Comment Utility
please comment.
T.P.
0
 
LVL 1

Author Comment

by:jonleehacker
Comment Utility
Thanks, I got it to work!!!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now