View Full Version : redirect

06-19-2002, 10:14 PM
I have a mail form that works correctly in IE but not in netscape. Actually in netscape the form works but will not redirect to the "thank you for inquiry" page. this is what i'm using to redirect.

// put the redirect url in here absolute or relative urls can be used

could i put a script on the "Submit" button" to redirect it once it is submitted? Any suggestions would be greatly appreciated!


06-19-2002, 10:26 PM
i havnt got netscape but maybe you should use the whole sytax I.E:

someone should start a petition for making netscape and IE use the W3 norm

06-19-2002, 10:43 PM
yea, unfortunately that didn't work either.

06-19-2002, 11:19 PM
what about:


06-19-2002, 11:31 PM
What about posting your whole script so we can have a look?

06-19-2002, 11:35 PM
no, unfortunately that didn't work either. Also, I just found out that the script doesn't work on mac browsers. Does anyone have a crossbrowser javascript for a simple form to submit info to an email address? in the form i have first, last name, address1, address2, city, state, zip, phone email, url , comments.

06-19-2002, 11:38 PM
here is the script.
<script language="JavaScript" type="text/javascript">
<!-- Hide script from older browsers
// This script validates fields, returns error messages, submits form and redirects page

// Ensure that ESSENTIAL FIELDS have been filled in.
function CheckFields(pform) {

// The fields are checked for blanks
if ( pform.FIRSTNAME.value == "" ||
pform.SURNAME.value == "" ||
pform.EMAIL.value == "" ||
pform.ADDRESS.value == "" ||
pform.CITY.value == "" ||
pform.STATE.value == "" ||
pform.POSTCODE.value == "" ||
pform.PHONE.value == "" ) {
alert( "Data in essential fields missing.\nPlease ensure that all fields are filled in." );
return false;

// check for valid email address
else if ( pform.EMAIL.value.length <= 6 ||
pform.EMAIL.value.indexOf ('@', 0) == -1 ||
pform.EMAIL.value.indexOf ('.', 0) == -1){

alert("'' " + pform.EMAIL.value + " '', is not valid Email Address.");
return false;

else {

// If reached this far then thank user, submit form and show redirect page

alert ("'Thank you for your registration submission.'" +pform.FIRSTNAME.value + " '' \nPlease wait a moment while your data is sent to our server")

// put your email address in here
// put the redirect url in here absolute or relative urls can be used
window.document.location.href ="thanks.html";

return true;


//End Hiding -->

06-20-2002, 12:18 AM
try changing this line:

window.document.location.href ="thanks.html";

to this:


This type of script is dependant on the users email client so that may be why it wont work for some people.

06-20-2002, 01:17 AM
thanks but that didn't work either. also, if it is dependant on the users email client does that mean if I'm in netscape I have to use netscape as my email client for the form to work? Could you recommend a place for me to go and find one that isn't ?

06-20-2002, 02:42 AM
Unfortunately, the only way to get around the user's dependency upon their email client is to send an email (and redirect) using server-side scripting.

Actually, my free formmail at http://www.solidscripts.com does what you want (as do about a half-dozen (possibly more) others on the internet, like http://www.bravenet.com and www.formbuddy.com - those are the only two others I can remember offhand) -

Basically these services allow you to post your form to a remote server, it then emails the form contents to you, and then redirects to whatever "thankyou" page you have set up on your website.

I would also recommend learning a server-side language of your choice... then you can do pretty much whatever you want!!!

Hope this helps!

06-21-2002, 12:42 AM
great! I really appreciate it.

06-21-2002, 12:51 AM
P.S. JohnKrutsch's solution above would usually work (even though there are still problems relying on the "mailto" action)... he just left out the closing double quote...


06-21-2002, 12:54 AM
yea, i did notice the end quote. does it need a ; at the end?

06-21-2002, 01:21 AM
Not technically - as javascript when compiled will add a ; if it isn't there...

But it's good coding practice to include the ; where it should be... i.e. like this:

var foobar = "Muahaha";