Web Analytics Made Easy -
StatCounter redirect - CodingForum

Announcement

Collapse
No announcement yet.

redirect

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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:[email protected]";
    // 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
    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

    Comment


    • #3
      yea, unfortunately that didn't work either.

      Comment


      • #4
        what about:

        location.replace("thankyou.htm")

        Comment


        • #5
          What about posting your whole script so we can have a look?

          Comment


          • #6
            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.

            Comment


            • #7
              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:[email protected]";
              // put the redirect url in here absolute or relative urls can be used
              window.document.location.href ="thanks.html";


              return true;
              }

              }

              //End Hiding -->
              </script>

              Comment


              • #8
                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.

                Comment


                • #9
                  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 ?

                  Comment


                  • #10
                    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; Jun 19, 2002, 08:44 PM.
                    Former ASP Forum Moderator - I'm back!

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

                    Comment


                    • #11
                      great! I really appreciate it.

                      Comment


                      • #12
                        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. ;)

                        Comment


                        • #13
                          yea, i did notice the end quote. does it need a ; at the end?

                          Comment


                          • #14
                            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. ;)

                            Comment

                            Working...
                            X