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 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Redirecting to new URL after form validated and submitted

    Hello I'm looking for the code for Redirecting to new URL after form validated and submitted

    When I put OnSubmit go to URL, the form is not validated and is not submited to my email...

    What can I do? right now I have this code that validates and submits this form correctly:
    Code:
    <script language="JavaScript" type="text/JavaScript">
    <!--
    
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_validateForm() { //v4.0
      var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
      for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
        if (val) { nm=val.name; if ((val=val.value)!="") {
          if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
            if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
          } else if (test!='R') { num = parseFloat(val);
            if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
            if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
              min=test.substring(8,p); max=test.substring(p+1);
              if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
        } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
      } if (errors) alert('The following error(s) occurred:\n'+errors);
      document.MM_returnValue = (errors == '');
    }
    //-->
    </script>
    and then:

    Code:
    <form action="mailto:press@avilajet.com" method="post" name="form1" onSubmit="MM_validateForm('Apelido/Nome','','R','Tel Trabalho','','R','Telem&oacute;vel','','R','E-mail','','R','Morada','','R','localidade1','','R','Titulo meio','','R','Morada meio','','R','localidade2','','R');return document.MM_returnValue">
    what can I do to make it also go to a new URL after validating and submitting correctly?

    thanks
    my email: elsasantoscosta@gmail.com

  • #2
    New Coder
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PLEASE HELP ME.....

    my email: elsasantoscosta@gmail.com

  • #3
    New Coder
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can anybody help me please?? I've tried everyhing REAL!!!

    I read tutorials, went to other forums...everything...is there a roundabout to this problem?

  • #4
    New Coder
    Join Date
    Feb 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You should use PHP instead of the action="mailtoress@avilajet.com" as that will open the defult mail client, and is anoying, does your server have it?

    Code:
    <input type="submit" value="Submit" name="B1" onclick="location.href='http://www.google.com'">
    However that will not valadate first so why not add in the valadate js else (no errors) location.href??
    ----------------------------------------------
    ----------------------------------------------

  • #5
    New Coder
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you were saying that in the validation script I shoud put a code that if there was no errors it would go to the uRL..

    Yes that should do it!

    Can you give me the code?
    Where do I put it?
    I'm kind of new with javascript...


  •  

    Posting Permissions

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