PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

After upgrading to 1.7.x, Datepicker.css is always loaded

  1. I have a page on my site that uses a gravity form, and there is a jQuery datepicker also in use on the page, though it is not part of the form itself. After upgrading to 1.7.x it looks like Gravity Forms is now loading a datepicker.css file on the page, even though my form isn't using a datepicker in it. The stylesheet's rules are messing up my other datepicker, so I'd prefer if it wasn't loaded but I am relying on some of the other GF styles, which means I can't just disable GF's CSS completely. Any ideas?

    Posted 10 years ago on Monday May 20, 2013 | Permalink
  2. Richard Vav
    Administrator

    It looks like you are correct, datepicker.css is being enqueued whether there is a datepicker field present on the form or not.

    As a workaround try adding the following to your theme's functions.php file, it will check to see if the datepicker initialisation script has been enqueued and if it hasn't it will prevent the datepicker.css file from being included on the page.

    add_action('gform_enqueue_scripts','deregister_datepicker_css',10,2);
    function deregister_datepicker_css($form)
    {
        if(!wp_script_is('gforms_datepicker',$list='queue')){
            wp_deregister_style('gforms_datepicker_css');
        }
        return false;
    }

    Regards,
    Richard

    Posted 10 years ago on Monday May 20, 2013 | Permalink
  3. Brilliant! Worked like a charm. Thanks

    Posted 10 years ago on Monday May 20, 2013 | Permalink
  4. Richard Vav
    Administrator

    You're welcome

    Posted 10 years ago on Monday May 20, 2013 | Permalink

This topic has been resolved and has been closed to new replies.