Posted: 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. |
|
I am also getting the same error on /event-registration/?regevent_action=load_checkout_page and /event-registration/?regevent_action=post_multi_attendee |
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. |
|
|
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 |
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:
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:
|
|
|
Am I putting the JQuery inside of the () |
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:
And you change that code so it executes later on in the page load (on document ready). |
|
|
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 |
Hi there, I didn’t actually suggest to change the validation.js file. I made a suggestion to change the inline JavaScript. |
|
|
Ok what page should I be editing? |
I don’t know because I do not know which page or file your custom code was added to. |
|
|
oh I see. The person that modified the code doesn’t work here anymore. |
|
Any advice as to where I should be looking? |
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. |
|
|
Believe or not the validation error went away after removing the duplicate library. Thanks for your help as always. |
|
I am curious Josh, what tools do you use to discover duplicate JQuery libraries? |
I used the Chrome browser’s View > Developer > View Source feature and looked through each of the JavaScript files called on the page. |
|
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.