<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Putting datepicker script in header.php works but kills the js slider.</title>
		<link>https://legacy.forums.gravityhelp.com/topic/putting-datepicker-script-in-headerphp-works-but-kills-the-js-slider</link>
		<description>Gravity Support Forums Topic: Putting datepicker script in header.php works but kills the js slider.</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 06:52:45 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/putting-datepicker-script-in-headerphp-works-but-kills-the-js-slider" rel="self" type="application/rss+xml" />

		<item>
			<title>stanvdmaarel on "Putting datepicker script in header.php works but kills the js slider."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/putting-datepicker-script-in-headerphp-works-but-kills-the-js-slider#post-86131</link>
			<pubDate>Thu, 01 Nov 2012 08:08:12 +0000</pubDate>
			<dc:creator>stanvdmaarel</dc:creator>
			<guid isPermaLink="false">86131@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thx for your (fast!) support.&#60;/p&#62;
&#60;p&#62;Works for &#60;a href=&#34;http://www.bmwservicespecialist.nl/afspraak-maken/&#34; rel=&#34;nofollow&#34;&#62;http://www.bmwservicespecialist.nl/afspraak-maken/&#60;/a&#62; perfectly.&#60;br /&#62;
Made a seperate date_restriction.js in /js an added the '// change the 11 here to your form ID&#60;br /&#62;
add_action('gform_enqueue_scripts_1', 'enqueue_date_restriction', 10, 2);&#60;br /&#62;
function enqueue_date_restriction($form, $is_ajax) {&#60;br /&#62;
    // the script to restrict the dates is stored in the child theme /js/ subdirectory, and depends on jQuery&#60;br /&#62;
    wp_enqueue_script('date_restriction', get_stylesheet_directory_uri() . '/js/date_restriction.js', array('jquery'));&#60;br /&#62;
}' in functions.php&#60;/p&#62;
&#60;p&#62;But.... tried the same solution on &#60;a href=&#34;http://www.autobedrijfderooy.nl/afspraak-maken/&#34; rel=&#34;nofollow&#34;&#62;http://www.autobedrijfderooy.nl/afspraak-maken/&#60;/a&#62;&#60;br /&#62;
and that didn't work (weird....)&#60;br /&#62;
The date field is input 21 on form 18.&#60;/p&#62;
&#60;p&#62;So changed the the form number in date_restriction.js into #input_18_21&#60;br /&#62;
 and changed the function to '// change the 11 here to your form ID&#60;br /&#62;
add_action('gform_enqueue_scripts_18', 'enqueue_date_restriction', 10, 2);&#60;br /&#62;
function enqueue_date_restriction($form, $is_ajax) {&#60;br /&#62;
    // the script to restrict the dates is stored in the child theme /js/ subdirectory, and depends on jQuery&#60;br /&#62;
    wp_enqueue_script('date_restriction', get_stylesheet_directory_uri() . '/js/date_restriction.js', array('jquery'));&#60;br /&#62;
}&#60;br /&#62;
'&#60;br /&#62;
Somehow the restriction script isn't used on that input (21_18)...&#60;/p&#62;
&#60;p&#62;Stan
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Putting datepicker script in header.php works but kills the js slider."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/putting-datepicker-script-in-headerphp-works-but-kills-the-js-slider#post-85782</link>
			<pubDate>Wed, 31 Oct 2012 13:43:32 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">85782@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;On this page:&#60;br /&#62;
&#60;a href=&#34;http://www.bmwservicespecialist.nl/afspraak-maken/&#34; rel=&#34;nofollow&#34;&#62;http://www.bmwservicespecialist.nl/afspraak-maken/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I see the datepicker and the modifications you made to restrict dates.  That appears to be working.&#60;/p&#62;
&#60;p&#62;On this page:&#60;br /&#62;
&#60;a href=&#34;http://www.bmwservicespecialist.nl/&#34; rel=&#34;nofollow&#34;&#62;http://www.bmwservicespecialist.nl/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I see this error:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;Timestamp: 10/31/2012 12:36:54 PM
Error: TypeError: $.datepicker is undefined
Source File: &#60;a href=&#34;http://www.bmwservicespecialist.nl/&#34; rel=&#34;nofollow&#34;&#62;http://www.bmwservicespecialist.nl/&#60;/a&#62;
Line: 73&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;That's because you're trying to apply jQuery to an element which does not exist in the page.  If you want to include the script in the head of the page, you can make it load only on this one page by wrapping the code section in a conditional like &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
&#38;lt;?php if (is_page(2239)) { ?&#38;gt;
&#38;lt;script&#38;gt;
    // jquery to restrict the date range
&#38;lt;/script&#38;gt;
&#38;lt;?php } ?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;That will ensure your jQuery is output only on page 2239.  &#60;/p&#62;
&#60;p&#62;The proper way to do it is as I &#60;a href=&#34;http://www.gravityhelp.com/forums/topic/date-picker-excluding-todays-date#post-84682&#34; rel=&#34;nofollow&#34;&#62;detailed earlier&#60;/a&#62;, enqueuing the script whenever the form is called, but you can also conditionally include the script on just this page.  If you need the script on another page, you will need to update the conditional.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>stanvdmaarel on "Putting datepicker script in header.php works but kills the js slider."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/putting-datepicker-script-in-headerphp-works-but-kills-the-js-slider#post-85773</link>
			<pubDate>Wed, 31 Oct 2012 13:16:53 +0000</pubDate>
			<dc:creator>stanvdmaarel</dc:creator>
			<guid isPermaLink="false">85773@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Its on 'http://www.bmwservicespecialist.nl/' Don't be scared... its in Dutch&#60;br /&#62;
The (working) datepicker is located on &#60;a href=&#34;http://www.bmwservicespecialist.nl/afspraak-maken/&#34; rel=&#34;nofollow&#34;&#62;http://www.bmwservicespecialist.nl/afspraak-maken/&#60;/a&#62; on the bottom (&#34;voorkeurs datum&#34;, meaning &#34;preferred date&#34;)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Putting datepicker script in header.php works but kills the js slider."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/putting-datepicker-script-in-headerphp-works-but-kills-the-js-slider#post-85756</link>
			<pubDate>Wed, 31 Oct 2012 12:56:09 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">85756@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Please post a link to the page on your site where the form is embedded so we can take a look.  Thank you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>stanvdmaarel on "Putting datepicker script in header.php works but kills the js slider."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/putting-datepicker-script-in-headerphp-works-but-kills-the-js-slider#post-85749</link>
			<pubDate>Wed, 31 Oct 2012 12:25:50 +0000</pubDate>
			<dc:creator>stanvdmaarel</dc:creator>
			<guid isPermaLink="false">85749@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Can't get the datepicker script working AND keeping the slider it to work properly. Putting the the script in the header.php does the filtering of the dates in the datepicker. So the&#60;br /&#62;
'&#60;br /&#62;
&#38;lt;script type=&#34;text/javascript&#34;&#38;gt;&#60;br /&#62;
jQuery.noConflict();&#60;br /&#62;
jQuery(document).ready(function($) {&#60;/p&#62;
&#60;p&#62;$( &#34;#input_1_68&#34; ).datepicker({ defaultDate: '+3d', minDate: '+3d', beforeShowDay: $.datepicker.noWeekends ,gotoCurrent: true, prevText: '', showOn: 'both', buttonImage: '/wp-content/plugins/gravityforms/images/calendar.png', buttonImageOnly: true });&#60;br /&#62;
});&#60;br /&#62;
&#38;lt;/script&#38;gt;' seems right.&#60;br /&#62;
BUT.... then the js slider on the homepage doesn't appear anymore. Removing the script brings back the slider, but more more date exclusions... The same issue on multiple themes. Been trying for a over a day now to get it working. The Jquery page is great, if you know already js and how to implement it. &#60;/p&#62;
&#60;p&#62;Guess some conflicting js...
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
