<?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: Jquery Date range - functionality lost upon selecting a date</title>
		<link>https://legacy.forums.gravityhelp.com/topic/jquery-date-range-functionality-lost-upon-selecting-a-date</link>
		<description>Gravity Support Forums Topic: Jquery Date range - functionality lost upon selecting a date</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 02:54:44 +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/jquery-date-range-functionality-lost-upon-selecting-a-date" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Jquery Date range - functionality lost upon selecting a date"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/jquery-date-range-functionality-lost-upon-selecting-a-date#post-69584</link>
			<pubDate>Sun, 05 Aug 2012 20:33:32 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">69584@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Please post a URL to your site if you need additional assistance.  Thank you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Ketiga on "Jquery Date range - functionality lost upon selecting a date"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/jquery-date-range-functionality-lost-upon-selecting-a-date#post-69551</link>
			<pubDate>Sun, 05 Aug 2012 10:03:56 +0000</pubDate>
			<dc:creator>Ketiga</dc:creator>
			<guid isPermaLink="false">69551@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Combining the two helped out a little;&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;var $j = jQuery.noConflict();

$j(document).ready(function(){

$j(&#38;quot;#input_3_21&#38;quot;).datepicker({
defaultDate: &#38;#39;+1d&#38;#39;,
minDate: &#38;#39;+1d&#38;#39;,
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
var instance = $j(this).data(&#38;quot;datepicker&#38;quot;);
var date = $j.datepicker.parseDate(instance.settings.dateFormat &#124;&#124; $j.datepicker._defaults.dateFormat, selectedDate, instance.settings);

           				$j( &#38;quot;#input_3_22&#38;quot; ).datepicker( &#38;quot;option&#38;quot;,&#38;quot;minDate&#38;quot;, date );
			}

	});   

$j(&#38;quot;#input_3_22&#38;quot;).datepicker({
defaultDate: &#38;#39;+1d&#38;#39;,
minDate: &#38;#39;+1d&#38;#39;,
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
var instance = $j(this).data(&#38;quot;datepicker&#38;quot;);
var date = $j.datepicker.parseDate(instance.settings.dateFormat &#124;&#124; $j.datepicker._defaults.dateFormat, selectedDate, instance.settings);

				$j( &#38;quot;#input_3_21&#38;quot; ).datepicker(&#38;quot;option&#38;quot;,&#38;quot;maxDate&#38;quot;, date );
			}

	});   

});&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Ketiga on "Jquery Date range - functionality lost upon selecting a date"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/jquery-date-range-functionality-lost-upon-selecting-a-date#post-69550</link>
			<pubDate>Sun, 05 Aug 2012 09:34:06 +0000</pubDate>
			<dc:creator>Ketiga</dc:creator>
			<guid isPermaLink="false">69550@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Using the code below, which I found here:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://stackoverflow.com/questions/5922184/create-a-specific-date-range-with-jquery-datepicker&#34; rel=&#34;nofollow&#34;&#62;http://stackoverflow.com/questions/5922184/create-a-specific-date-range-with-jquery-datepicker&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;it does seem to work. Still I'd like to know why the other code didn't, since I understand it better.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;var $j = jQuery.noConflict();

$j(document).ready(function(){

var fromDate = $j(&#38;quot;#input_3_21&#38;quot;).datepicker({
        defaultDate: &#38;quot;+0d&#38;quot;,
        changeMonth: true,
        numberOfMonths: 2,
        minDate: new Date(),
        onSelect: function(selectedDate) {
            var instance = $j(this).data(&#38;quot;datepicker&#38;quot;);
            var date = $j.datepicker.parseDate(instance.settings.dateFormat &#124;&#124; $j.datepicker._defaults.dateFormat, selectedDate, 

instance.settings);
        toDate.datepicker(&#38;quot;option&#38;quot;, &#38;quot;minDate&#38;quot;, date);
        }
    });

    var toDate = $j(&#38;quot;#input_3_22&#38;quot;).datepicker({
        defaultDate: &#38;quot;+0d&#38;quot;,
        changeMonth: true,
        numberOfMonths: 2
    });

});&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Ketiga on "Jquery Date range - functionality lost upon selecting a date"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/jquery-date-range-functionality-lost-upon-selecting-a-date#post-69545</link>
			<pubDate>Sun, 05 Aug 2012 05:30:05 +0000</pubDate>
			<dc:creator>Ketiga</dc:creator>
			<guid isPermaLink="false">69545@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hmm, weird.&#60;/p&#62;
&#60;p&#62;When I select a date in field two, the month and year in date field one jump to december 2006&#60;/p&#62;
&#60;p&#62;:S
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Ketiga on "Jquery Date range - functionality lost upon selecting a date"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/jquery-date-range-functionality-lost-upon-selecting-a-date#post-69544</link>
			<pubDate>Sun, 05 Aug 2012 04:54:17 +0000</pubDate>
			<dc:creator>Ketiga</dc:creator>
			<guid isPermaLink="false">69544@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;I've seen many posts on the date range and date picker functionality but unfortunately they have not fixed my issue.&#60;/p&#62;
&#60;p&#62;-I have created two date fields in my form&#60;/p&#62;
&#60;p&#62;-I use the following code in a file called date-range.js&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;var $j = jQuery.noConflict();

$j(document).ready(function(){

$j(&#38;quot;#input_3_21&#38;quot;).datepicker({
defaultDate: &#38;#39;+1d&#38;#39;,
minDate: &#38;#39;+1d&#38;#39;,
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
				$j( &#38;quot;#input_3_22&#38;quot; ).datepicker( &#38;quot;option&#38;quot;,&#38;quot;minDate&#38;quot;, selectedDate );
			}

	});   

$j(&#38;quot;#input_3_22&#38;quot;).datepicker({
defaultDate: &#38;#39;+1d&#38;#39;,
minDate: &#38;#39;+1d&#38;#39;,
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
				$j( &#38;quot;#input_3_21&#38;quot; ).datepicker(&#38;quot;option&#38;quot;,&#38;quot;maxDate&#38;quot;, selectedDate );
			}

	});   

});&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;In my theme functions file I use:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;#39;gform_enqueue_scripts_3&#38;#39;, &#38;#39;enqueue_date_range_script&#38;#39;, 10, 2);
function enqueue_date_range_script($form, $is_ajax) {
        wp_enqueue_script(&#38;#39;date_range_script&#38;#39;, get_stylesheet_directory_uri() . &#38;#39;/js/date-range.js&#38;#39;, array(&#38;#39;jquery&#38;#39;));
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Before selecting any date everything is fine. The default, mindate and three visible months all work as expected when I click the field.&#60;/p&#62;
&#60;p&#62;The problem occurs on selecting a date in my SECOND date field (the 'to' date). When I do this and go back to my first date field ( the  'from' date) to change the date, all values are greyed out.&#60;/p&#62;
&#60;p&#62;In the second date field the mindate and other conditions are lost when selecting a date in field one.&#60;/p&#62;
&#60;p&#62;I am also able to select a date before the date of date field one, which should not be possible. &#60;/p&#62;
&#60;p&#62;The code for the date range was copied from here:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://jqueryui.com/demos/datepicker/#date-range&#34; rel=&#34;nofollow&#34;&#62;http://jqueryui.com/demos/datepicker/#date-range&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I made some minor adjustments.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
