Javascript Validate Form Not running

I tried using the Javascript error in page code found here

However when implemented into my form the validation no longer works and I believe that the page isn’t picking up to run the javascript like it should when the form submits.

<form id="UserAddForm" method="post" action="" accept-charset="utf-8" name="UserAddForm"><div style="display:none;"><input type="hidden" name="_method" value="POST" /></div>
    
<div id='UserAddForm_errorloc' class='error_strings'></div> 

    <h1>Register</h1>

        <ul class="inputfields">
            <li>
                <span>Username:</span>

                <br />
                <div class="input text"><input name="data[User][username]" type="text" maxlength="75" id="UserUsername" /></div>            </li>
            <li>
                <span>Password:</span>

                <br />
                <div class="input password"><input type="password" name="data[User][password]" id="UserPassword" /></div>            </li>
            <li>

                <span>Confirm Password:</span>
                <br />
                <input type="password" name="data[User][confirm_password]" id="UserConfirmPassword" />            </li>
            <li>

                <span>E-mail:</span>
                <br />
                <div class="input text"><input name="data[User][email]" type="text" maxlength="75" id="UserEmail" /></div>            </li>

            <li>
                <span>Display Name:</span>
                <br />
                <div class="input text"><input name="data[User][displayname]" type="text" maxlength="50" id="UserDisplayname" /></div>            </li>

        </ul>

    <div class="submit"><input type="submit"  value="Submit" />
    </div></form>
    <div id='UserAddForm_errorloc' class='error_strings'></div> 
    <script language="JavaScript" type="text/javascript">
  var frmvalidator  = new Validator("UserAddForm");

  frmvalidator.EnableOnPageErrorDisplaySingleBox();
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("data[User][username]","req",
  "Please enter your Username");
 
  frmvalidator.addValidation("data[User][password]","req",
  "Please enter your Password");
  frmvalidator.addValidation("data[User][password]","minlen=6",
  "Min length is 6");
  
  frmvalidator.addValidation("data[User][confirm_password]","req",
  "Please confirm your Password");
  frmvalidator.addValidation("data[User][confirm_password]","minlen=6",
  "Min length is 6");
 
  frmvalidator.addValidation("data[User][email]","maxlen=50");
  frmvalidator.addValidation("data[User][email]","req",
  "Please enter your e-mail address");
  frmvalidator.addValidation("data[User][email]","email",
  "This is not a valid email address, please re-e);
 
  frmvalidator.addValidation("data[User][displayname]","req",
  "Please enter a Display Name");

</script>

This is the file controlling the submit function:
http://www.javascript-coder.com/html-form/gen_validatorv31.js

Of course I have my own copy on the server, but whenever I submit the form I created, nothing happens. It just submits without running the validation. Any help in this matter would be greatly appreciated!

Put an onsubmit event handler in your opening form tag which runs your validation function. The validation function must return either true or false. If it returns true (meaning all form data is valid) the form will be submitted. If it returnd false, the form will not be submitted.

Google onsubmit if you haven’t used it before.

The issue is that you aren’t supposed to have to do that from the documentation. The example provided does not use the onSubmit event handler.

Example Shown Here

Supposedly the genvalidator file overrides the onSubmit function.

There are errors in the javascript file for example:

Error: frmvalidator.EnableOnPageErrorDisplaySingleBox is not a function

There is an incomplete string

frmvalidator.addValidation("data[User][email]","email",
  "This is not a valid email address, please re-e);

If the script gen_validatorv31.js is linked properly, it should work fine.

The attached file contains the corrected code