Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14

Thread: redirect

  1. #1
    elo
    elo is offline
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    redirect

    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.

    pform.action="mailto:gino@blah.com";
    // put the redirect url in here absolute or relative urls can be used
    location.href="thanks.html";

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

    Thanks

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    paris, france
    Posts
    1,216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i havnt got netscape but maybe you should use the whole sytax I.E:
    window.document.location.href

    someone should start a petition for making netscape and IE use the W3 norm
    photoshop too expensive? use the GIMP! www.gimp.org

  • #3
    elo
    elo is offline
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yea, unfortunately that didn't work either.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what about:

    location.replace("thankyou.htm")

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    What about posting your whole script so we can have a look?

  • #6
    elo
    elo is offline
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #7
    elo
    elo is offline
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    pform.action="mailto:ricky@xtramayo.com";
    // put the redirect url in here absolute or relative urls can be used
    window.document.location.href ="thanks.html";


    return true;
    }

    }

    //End Hiding -->
    </script>

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    try changing this line:

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

    to this:

    setTimeout("location='thanks.html',500)


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

  • #9
    elo
    elo is offline
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ?

  • #10
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!
    Last edited by whammy; 06-20-2002 at 02:44 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #11
    elo
    elo is offline
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    great! I really appreciate it.

  • #12
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

    setTimeout("window.location='thankyou.htm'",500)
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #13
    elo
    elo is offline
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yea, i did notice the end quote. does it need a ; at the end?

  • #14
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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";
    if(1=1){
    alert(foobar);
    }
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •