Help Desk

JS error causing plugin conflicts

  • Posts: 17 Topics: 8
    | Permalink

    On our site, after the latest Events Calendar update, there is a JS error being thrown related to the Events Calendar widget. Using Chrome Dev Tools’ pretty print, the error shows this:

    TypeError: Cannot set property 'date' of undefined
        at u (tribe-events-ajax-calendar.min.js?ver=4.6.21:formatted:25)
        at p (tribe-events-ajax-calendar.min.js?ver=4.6.21:formatted:49)
        at c (tribe-events-ajax-calendar.min.js?ver=4.6.21:formatted:62)
        at HTMLDocument.<anonymous> (tribe-events-ajax-calendar.min.js?ver=4.6.21:formatted:178)
    

    On pages with simple forms (we use Gravity Forms), this doesn’t cause problems for most users, but on pages with forms using conditional logic, which requires JS, it prevents the form from showing at all. We’ve temporarily gotten around the issue by removing the sidebar from pages with forms using conditional logic, but that’s not our ideal solution.

    The script error only happens when the calendar widget is loaded. If I prevent the widget loading by disabling the sidebar on affected pages, the forms work correctly.

    Posts: 2500
    | Permalink

    Hi there,

    Thanks for emailing support and sorry you are having issues. Sounds like there is a conflict. To get you started on troubleshooting: First, please make sure you are using the most current versions of all of our plugins. You can also try reinstalling them by following these instructions. If that doesn’t help, the next step in troubleshooting this is going to be testing for conflicts with your theme and other plugins (with WP_DEBUG enabled). If you need a testing environment, the free WP Staging plugin will let you create a quick copy of your live site that you can use for testing.

    Let me know what you find.

    You can also try installing this plugin to dequeue scripts from the calendar and see if that solves the issue.

    Thanks,
    Brendan

    Posts: 17 Topics: 8
    | Permalink

    The issue exists in the tribe_mobile_setup_day method in the tribe-events-calendar.js file. When debugging is enabled, the full error reads:

    Uncaught TypeError: Cannot set property 'date' of undefined
        at tribe_mobile_setup_day

    Doing a console.log on the data variable set there (

    $date.data( 'tribejson' )

    ) shows that it’s undefined. You can replicate this by using Chrome Dev tools and viewing a page with the calendar widget with the mobile view on.

    This has been checked with all other plugins deactivated, most recent versions of the plugins, and using a default theme. The JS error persists in the referenced file. If I add an early return if the data variable is not defined, the script error disappears and the JS conflict is resolved, although I don’t know what events functionality I may be losing or breaking by adding the early return.

    Posts: 2500
    | Permalink

    Hi there,

    Thanks for the feedback. We are seeing this error and as such, I have created a bug ticket so our devs can take a look. Not sure when it will be resolved at this point, but someone will notify you via this ticket as soon as we have a resolution.

    Thanks,
    Brendan

    Posts: 4 Topics: 5
    | Permalink

    I am having the SAME issues with forms not showing – but only on mobile devices, they seem to work fine on laptops.
    As a workaround, I have set pages with forms to have no sidebar.

    Posts: 2500
    | Permalink

    Hi there,

    Thanks for the feedback and temporary solution.

    Brendan