Support » Plugin: Contact Form by WPForms - Drag & Drop Form Builder for WordPress » Nearly perfect, but jQuery dependent :(

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Ethan Choi

    (@ethanchoi)

    Hey @seokai,

    Sorry to hear that you’re running into issues!

    However, WPForms loads its assets conditionally on pages where a form is displayed.

    In order for us to troubleshoot the issue, could you create a post in our WPForms Lite support forum, and share the URL of your site there?

    Thanks!

    Thread Starter Kai Spriestersbach

    (@seokai)

    That may be true for CSS and form-specific JS, but why is jQuery and the Recaptcha JS loaded on every page, even when no form at all is displayed?

    Plugin Author Jared Atchison

    (@jaredatch)

    Hey @seokai,

    Unless a form is placed in location that displays globally on your site (such as a footer widget), all WPForms assets and dependencies – including jQuery and reCAPTCHA – are only loaded for pages that contain a form.

    Just to triple check this, I spun up a new WordPress install with only the TwentyTwenty theme and WPForms Lite activated. I then created a /contact page which has WPForms embedded on it.

    Viewing the home page and looking at the source, there’s no references to jQuery (https://a.cl.ly/DOuxr7mY) or reCAPTCHA (https://a.cl.ly/WnuJDPq4).

    However, once I go to the Contact page which contains a form jQuery (https://a.cl.ly/OAuqje80) and reCAPTCHA (https://a.cl.ly/YEuoW0kb) are indeed included.

    I know that it’s common theme and plugin functionality to require jQuery, so my best guess is likely the theme or another plugin that is requiring it globally.

    With reCAPTCHA, it’s not as common, but we have seen themes that integrate with reCAPTCHA out of the box load the embed script globally. If you look at the reCAPTCHA script tag, if it doesn’t contain wpformsRecaptchaLoad (https://a.cl.ly/xQuLx8N0) then that’s a good indicator it’s loading from a call outside WPForms.

    Worth nothing, it IS possible to load WPForms assets on every page, but it’s not enabled by default – it’s a nuclear option we provide to users with theme conflicts and similar. Just to be safe, if you go to your WPForms Settings, you’ll see a checkbox for “Load Assets Globally” (https://a.cl.ly/jkuZWN0k).

    As far as jQuery as a dependency in general, I do agree that it would be ideal to not need jQuery at all. The thing with that is many of the libraries we use (validation, time picker, payment validation, etc) are jQuery libraries – so finding adequate replacements for these all while attempting to keep backwards compatibility would be a big under taking. That’s not to say it won’t happen, but it will take careful planning and execution.

    The other thing is jQuery provides us with a toolkit of helper functions. The library itself is around 34kb gzipped delivered, but refactoring all functionality with vanilla JS and then transpiling could very well negate any gains ditching the dependency itself.

    Lastly, we do very much care and pay attention to page load times and general site overhead, because with over 3M sites using WPForms, it’s our duty. We do frequently profile and benchmark releases, so if you see something that looks “off” to you, please let us know so we can investigate.

    Anyways, we do really appreciate all feedback. Hope this helps provide some context to things.

    Have a great weekend,

    Jared

    Thread Starter Kai Spriestersbach

    (@seokai)

    Hi Jared,

    I really appreciate your effort and am deeply sorry – the cause was another plugin (hummingbird) which tries to help with pagespeed, but unfortunately make all enqueued scripts and stylesheets global!
    So it is not WP Forms fault – I changed my review to reflect that!

    Sorry for the hassle

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Nearly perfect, but jQuery dependent :(’ is closed to new replies.