Redirect Code Help

liunx

Guest
Just took over this website and have little experience. One small project I'm trying is to add redirect code to the forms on the website. The problem is that the page redirects whenever I click in any of the form fields (ie. when I click in "Name" it redirects) I really only want to redirect upon clicking Submit. The code I have is listed here:<br />
<br />
<FORM METHOD="POST" ACTION="mailto:[email protected]""target="top"<br />
onClick="location='thank.html'"?subject=form information"<br />
ENCTYPE="ENCTYPE=x-www-form-urlencoded"><br />
<A NAME="top"></A><!--content-->That's because you're using the form onclick function. Using it this way means that once you click anywhere on the form, perform the redirection.<br />
<br />
Try it this way:<br />
<br />
function redirect() {<br />
window.location = "thank.html";<br />
}<br />
<br />
<form onsubmit="redirect()"></form><br />
<br />
Havik<!--content-->This may be silly, but where do I insert the code that you listed? I tried it getting rid of the "on click" code that I had and that didn't seem to do anything.<!--content-->Here is the page/code itself if this helps.<!--content-->First of all, where do you want it to redirect to?<br />
<br />
The form target is top, so this'll essentially scroll to the top of this page. While you have a 'thanks.html' page. This is need to know so I can help out better.<br />
<br />
Question: Do you want it to reset and scroll to the top of this page while having a popup thanks window? Because that's what it looks like.<br />
<br />
Havik<!--content-->First of all, thanks for your help. <br />
<br />
There are 2 buttons at the bottom of the page - 1 should submit the form (mailto) and the other one should clear the form (Start Over).<!--content-->This is how I got it to work:<br />
<br />
<script language="Javascript"><br />
<br />
function redirection() {<br />
// place your target here<br />
// "#top" if it is the top of page<br />
// "thanks.html" if it is that page<br />
window.location.href = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/">http://www.webdeveloper.com/forum/archive/index.php/</a><!-- m -->"http://www.yahoo.com";<br />
}<br />
<br />
</script><br />
<br />
</HEAD><br />
<style><!--a:hover{color:red}--></style><br />
<body topmargin=0 leftmargin=0 bottommargin=0 rightmargin=0 bgcolor="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF"><br />
<FORM METHOD="POST" ACTION="mailto:email address here" onsubmit="redirection();" ?subject=form information"<br />
ENCTYPE="ENCTYPE=x-www-form-urlencoded"><br />
<A NAME="top"></A><!--content-->Humm. I entered the code -still not working. I'm sorry this is such a pain!<br />
<br />
<br />
<br />
<META NAME="Keywords" CONTENT="Booklog, books, bookstore, bookselling, bookseller, <br />
pos, point of sale, inventory, control, management, software, hardware, retail, <br />
computerized, ISBN"><br />
<br />
<script language="Javascript"><br />
<br />
function redirection(){thanks.html window.location.href <br />
<br />
="http://www.booklog.com/thanks";}<br />
<br />
</script><br />
<br />
</HEAD><br />
<style><!--a:hover{color:red}--></style><br />
<body topmargin=0 leftmargin=0 bottommargin=0 rightmargin=0 bgcolor="#FFFFFF" <br />
<br />
link="#FFFFFF" vlink="#FFFFFF"><br />
<FORM METHOD="POST" ACTION="mailto:[email protected]" onsubmit="redirection();"<br />
?subject=form information"<br />
ENCTYPE="ENCTYPE=x-www-form-urlencoded"><br />
<A NAME="top"></A><!--content-->That should work. Those comments were there as documentation, not to be taken literally.<br />
<br />
Havik<br />
<br />
<br />
<script language="Javascript"> <br />
<br />
function redirection(){<br />
<br />
window.location.href =http://www.webdeveloper.com/forum/archive/index.php/"http://www.booklog.com/thanks";<br />
<br />
} <br />
<br />
</script><br />
<br />
EDITION NOTE: try inserting the extention to the thanks page if it still won't work.<br />
<br />
example: If the page is an html page<br />
"http://www.booklog.com/thanks.html"<br />
<br />
Havik<!--content-->Thank You. That worked perfectly!<!--content-->
 
Back
Top