0

I'm trying to implement the form validation that can be found at: http://www.geektantra.com/2009/09/jquery-live-form-validation/

I can get the demo above working, but when I implement it on my wordpress site no validation occurs.

The page where it's implemented is here: http://www.melbournemeditationcentre.com/meditation-courses/course-registration/

You'll see that the neccesary scripts are included:

  1. jquery.validate.js?ver=3.8
  2. jquery.js?ver=1.10.2
  3. form-validation.css?ver=3.8

as well as the necessary code in the head:

jQuery(function(){
        jQuery("#firstname").validate({
            expression: "if (VAL.match(/^[A-Za-z '-]{3,20}$/) && VAL) return true; else return false;",
            message: "Required."
        });
    });

etc....

As far as I can tell, the form itself is all okay. Still no validation.

1 Answer 1

-1

Your page through javascript errors. Try loading the validation scripts on footer (before closing </body> tag) rather than within header (within <head> tag).

If that doesn't work, then try editing the jquery.validate.js file, and replace the first line (function(jQuery){ with (function($){. It should work.

2
  • Moving the scripts to the footer worked. I didn't need to change the first line in jquery.validate.js
    – whymatt
    Commented Dec 15, 2013 at 6:24
  • This answer ignores all the functionality WordPress offers you to declare dependencies and script locations. Commented Dec 15, 2013 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.