ackg37 Posted January 8, 2010 Share Posted January 8, 2010 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"> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.