Jump to content

contact form- how to redirect on submit


ackg37

Recommended Posts

I have a functioning contact form. I want to add a redirect; right now it automatically redirects to the index page. However, the 'onsubmit' attribute is already being used to validate the form. I can't alter the php script the form uses, so have to do all this from my end. How else could I keep form validation or tell it where to redirect on submission? The code is included below. 

Thanks!

 

In the head: 

<script type="text/javascript">
function checkForm(frm){
msg = "";
   if(!frm.name.value){
      msg += "- Name is required\n";
   }
   if(!frm.email.value){
      msg += "- Address is required\n";
   }
   if(!frm.location.value){
      msg += "- Email is required\n";
   }
   if(!frm.schedule.value){
      msg += "- Email is required\n";
   }
   if(!frm.likes.value){
      msg += "- Email is required\n";
   }
   if(!frm.dislikes.value){
      msg += "- Email is required\n";
   }
   if(msg != ""){
      alert(msg);
      return false;
   }
}
</script> 

 

In the table: 

<form action="/webformmailer.php" method="post" onsubmit="return validate_form(this)>
    input type=hidden name="required" value="email,phone">

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.