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> 


        <ul class="inputfields">

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

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

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

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

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


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

  "Please enter your Username");
  "Please enter your Password");
  "Min length is 6");
  "Please confirm your Password");
  "Min length is 6");
  "Please enter your e-mail address");
  "This is not a valid email address, please re-e);
  "Please enter a Display Name");


This is the file controlling the submit function:

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

  "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