I am working with a CMS system and have restrictions on where I can place code (at the moment). The script I'm trying to use must load after a form and it works successfully in Dreamweaver. But now that I'm moving things into the CMS I must run the script in the header instead of after the form. I'm attempting to load it using after the page loads like so:
<script>
$(document).ready(function() {
//You should create the validator only after the definition of the HTML form
var frmvalidator = new Validator("leadform");
frmvalidator.EnableOnPageErrorDisplaySingleBox();
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("first_name","req","Please enter your first name.");
frmvalidator.addValidation("first_name","maxlen=40","Max length for first name is 40.");
frmvalidator.addValidation("first_name","alpha","Please enter your first name.");
frmvalidator.addValidation("last_name","req","Please enter your last name.");
frmvalidator.addValidation("last_name","maxlen=40","Max length for last name is 40.");
frmvalidator.addValidation("last_name","alpha","Please enter your last name.");
frmvalidator.addValidation("email","req","Please enter your e-mail address.");
frmvalidator.addValidation("email","email","Please enter your e-mail address.");
frmvalidator.addValidation("state","dontselect=0","Please select your state.");
});
</script>
I have to believe that I'm just writing this all wrong but I can't find any examples that will help me do this. Clearly I'm a noob coder - any help would be appreciated.
Thanks.