Support

Home Forums Event Espresso Premium Validation Error

Validation Error

Posted: October 4, 2017 at 11:12 am

Viewing 16 reply threads


Maccabee Levine

October 4, 2017 at 11:12 am

I am getting a validation error in event-espresso/scripts/validation.js. Says that “validate” is not a function. Please advise.


Maccabee Levine

October 4, 2017 at 11:21 am

I am also getting the same error on /event-registration/?regevent_action=load_checkout_page and /event-registration/?regevent_action=post_multi_attendee


Josh

  • Support Staff

October 4, 2017 at 11:22 am

Hi there,

The validation.js script requires the jQuery validate plugin. Since you’re getting that error it’s an indication that the validate plugin is either loading too late or isn’t loading at all. Can you post a link to the page where this error is thrown so we can investigate further? There may be another WP plugin that’s removed the jQuery Validate plugin, but if we can check the page we can find out for sure whether it’s gone or just too late.


Maccabee Levine

October 4, 2017 at 11:36 am

https://quantum.esu.edu/theatre/event-registration/?regevent_action=show_shopping_cart

https://quantum.esu.edu/theatre/event-registration/?regevent_action=load_checkout_page

https://quantum.esu.edu/theatre/event-registration/?regevent_action=post_multi_attendee


Josh

  • Support Staff

October 4, 2017 at 11:54 am

OK there’s some customization that was done. Have you discussed this issue with the developer that made the customizations? This code was added to the middle of the page somehow:

jQuery(function(){
 //Registration form validation
 jQuery('#event_espresso_checkout_form').validate();
});

The problem is it’s too early to try to run that code because the validation plugin hasn’t been loaded at that point. You could try loading that code later (use the wp_add_inline_script() function via a custom function). Or you could change the code so it runs after the document is ready:

jQuery( document ).ready(function($){
 //Registration form validation
 $('#event_espresso_checkout_form').validate();
});


Maccabee Levine

October 4, 2017 at 1:21 pm

Am I putting the JQuery inside of the ()


Josh

  • Support Staff

October 4, 2017 at 1:33 pm

I’m afraid I don’t understand your question. You’re not actually going to put in anything new, but rather change what was already added via a customization. I do not know how the customized code was added, so the first step in fixing this is your find where this code was added:

jQuery(function(){
 //Registration form validation
 jQuery('#event_espresso_checkout_form').validate();
});

And you change that code so it executes later on in the page load (on document ready).


Maccabee Levine

October 4, 2017 at 1:38 pm

sorry

ok I changed the validation.js to your suggestion. The error went away on https://quantum.esu.edu/theatre/event-registration/?regevent_action=show_shopping_cart.

I am getting this error on https://quantum.esu.edu/theatre/event-registration/?regevent_action=load_checkout_page

Uncaught TypeError: jQuery(…).validate is not a function
at HTMLDocument.<anonymous> (?regevent_action=load_checkout_page:365)
at i (jquery.js?ver=1.12.4:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
at Function.ready (jquery.js?ver=1.12.4:2)
at HTMLDocument.K (jquery.js?ver=1.12.4:2)


Josh

  • Support Staff

October 4, 2017 at 1:55 pm

Hi there,

I didn’t actually suggest to change the validation.js file. I made a suggestion to change the inline JavaScript.


Maccabee Levine

October 4, 2017 at 2:01 pm

Ok what page should I be editing?


Josh

  • Support Staff

October 4, 2017 at 2:16 pm

I don’t know because I do not know which page or file your custom code was added to.


Maccabee Levine

October 4, 2017 at 2:17 pm

oh I see. The person that modified the code doesn’t work here anymore.


Maccabee Levine

October 4, 2017 at 2:18 pm

Any advice as to where I should be looking?


Josh

  • Support Staff

October 4, 2017 at 2:39 pm

That will depend. If they modified Event Espresso’s files directly, then you’ll look in the /templates folder. Other places include the /wp-content/uploads/espresso/templates directory and the WP theme folder too.

The other issue I’m seeing is there are two copies of the jQuery library loading. For example on this page version 1.12.4 is loading from line 45:

https://www.evernote.com/l/AATYiqZIBMFPZ4H7aABHc1RcES4igd4NyfY

That’s the one you want to be there. This other one can cause some issues and needs to be removed:

https://www.evernote.com/l/AASU1q4jE95L0biONyw3BPlxdcsZQcygk8U

That code is quite likely coming from the theme’s footer.php template file.


Maccabee Levine

October 5, 2017 at 6:35 am

Believe or not the validation error went away after removing the duplicate library.

Thanks for your help as always.


Maccabee Levine

October 5, 2017 at 6:42 am

I am curious Josh, what tools do you use to discover duplicate JQuery libraries?


Josh

  • Support Staff

October 5, 2017 at 6:47 am

I used the Chrome browser’s View > Developer > View Source feature and looked through each of the JavaScript files called on the page.

Viewing 16 reply threads

The support post ‘Validation Error’ 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