HTML Submit Form - run javascript and ASP JMail script

I have a simple feedback form and I use Javascript to validate the form on submit.  Here is the form tag and a little snippet of the Javascript validation code.

function verifyInput(theForm) {
      if (theForm.company.value == '') {
            alert("Please provide the name of your business organization.");
            theForm.company.focus();
            return false;
      }
      if (theForm.website.value == '') {
            alert("Please provide the URL of your business organization.");
            theForm.website.focus();
            return false;
                 and so on.................

'Form tag
<form action="" method="post" name="theForm" id="theForm" onsubmit="return verifyInput(this);">


QUESTION:  Can I still use this Javascript code for validation and if everything is valid, execute a different ASP page that contains the JMail script for mailing the information to me?  In other words, if the form is valid and all required fields inputted - redirect to another ASP page that executes the JMail script.

Thanks in Advance.

SK
LVL 4
kruegersteAsked:
Who is Participating?
 
Wim_BlConnect With a Mentor Commented:
Hi,

you mean like this ?

function verifyInput(theForm) {

...
     // if everything is valid...
     theForm.action = 'differentPage.asp'
...
}

You can even put your submit here, like theForm.submit()

greetings
0
All Courses

From novice to tech pro — start learning today.