Support

Home Forums Event Espresso Premium Signup Validation

Signup Validation

Posted: October 12, 2012 at 5:48 am

Viewing 5 reply threads


Tom Hayes

October 12, 2012 at 5:48 am

The validation isn’t working on any of the forms. So users can go all the way to the end of the signup process without entering any details at all.

Past suggestions for getting the validation working (wrapping in [raw] tags) doesn’t seem to do anything. When looking at the output html, there doesn’t appear to be any place where the validation function is called. Would you guys have any more tips on finding out where the validation might be breaking?

Another questions though; If users are able to get through the process without the JS validation working, does that mean that there is no server side validation in place? Or is my plugin broken on both ends?

Cheers


Dean

October 12, 2012 at 6:06 am

Hi Tom,

Generally this is due to a Javascript conflict or the Javascript being called incorrectly. Do you have a link to the site in question?

The forms are only validated via the Javascript.


Josh

  • Support Staff

October 12, 2012 at 6:29 am

Hi Tom,

If the script isn’t being called at all, this is likely from the WordPress theme not including the wp_footer() function. In order for most plugins to function properly, there needs to be a call to wp_footer in the footer.php template of the theme.

If it’s not there, you may need to contact the theme’s developer, or you can add it just before the closing body tag. Please see this reference for more info:
http://codex.wordpress.org/Function_Reference/wp_footer


Tom Hayes

October 12, 2012 at 7:43 am

Dean, this is the site in question

Josh, good call. The theme didn’t have the wp_footer() set. That done, the JS is still fhrowing up the error Uncaught TypeError: Object [object Object] has no method 'validate'

Any ideas?

  • This reply was modified 12 years, 2 months ago by Tom Hayes.
  • This reply was modified 12 years, 2 months ago by Tom Hayes.


Josh

  • Support Staff

October 12, 2012 at 8:38 am

Hi Tom,

The root of the problem here is there is a few things in this theme that are not following WordPress coding standards. So there are some dependancies that are not being met.

Looking at the source of the page again, I can see that the jQuery library is loading after the validate script. That’s why validate has no method. If if gets removed and added at an earlier part of the document, the validation script will work.

You can look in footer.php to see how it’s being called there, and check header.php to see if wp_head() is being called. (If it’s not there, it really needs to be.) Ideally, jQuery will load automatically in wp_head() if all the scripts that need it declare it as a dependency. You can also enqueue it from the functions.php file, and it will load the head of the document in the event that a script needs it, but doesn’t declare it. So in functions.php you can add:

<?php
function my_theme_scripts_method() {
    wp_enqueue_script( 'jquery' );
}    

add_action('wp_enqueue_scripts', 'my_theme_scripts_method');
?>

Here’s a simulated version of the above linked page with the jQuery library moved to the head of the document:
http://jsfiddle.net/joshfeck/BwG6t/embedded/result/

Here’s a reference that goes into more detail about how JavaScript should be loaded in a WordPress theme:
http://wpcandy.com/teaches/how-to-load-scripts-in-wordpress-themes


Tom Hayes

October 12, 2012 at 9:20 am

Josh, sorry aout this. It’s a silly error: the head didn’t have the wp_head().

Thanks for the support : )

Viewing 5 reply threads

The support post ‘Signup Validation’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso