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.

Datepicker Let's Older Dates Be Chosen and Won't Auto Close on Selection

  1. Lynne Pisan
    Member

    The title says it all and I can't figure it out. I also can't seem to find a solution searching for it here.

    The datepicker won't close after a selected date is chosen and it also lets you choose old past dates.

    What is the issue here?

    Posted 11 years ago on Wednesday March 6, 2013 | Permalink
  2. The default datepicker doesn't have a range limit. You would have to add some script to your theme files to prevent past dates.. you would add this to the header.php file of your theme or wherever your theme provider suggest you put custom scripts.

    <script type="text/javascript">
    jQuery(function () {
    
      var date = new Date();
      var currentMonth = date.getMonth();
      var currentDate = date.getDate();
      var currentYear = date.getFullYear();
    
      jQuery('#<%= txtDate.ClientID  %>').datepicker({
          minDate: new Date(currentYear, currentMonth, currentDate)
      });
    });
    </script>

    http://codeasp.net/blogs/raghav_khunger/microsoft-net/1084/jquery-datepicker-disable-past-dates

    As far as the not closing issue.. hard to say. Can you post a URL to your form so we can take a look?

    Posted 11 years ago on Thursday March 7, 2013 | Permalink
  3. Hello,

    I've seen a few people here needing a datepicker with a limited date range, myself included. So I've written a self contained plugin that adds an additional Advanced field that can have a restricted start date, end date, or date range. It has customisable validation messages and works just like a normal Gravity Forms field.

    It's free and hopefully people will find it useful - feedback is always appreciated.

    You can get it here: http://www.smartredfox.com/2013/05/gravity-forms-limited-date-field/

    Thanks,
    James

    Posted 11 years ago on Tuesday May 14, 2013 | Permalink
  4. David Peralty

    Are you going to be able to get that on the WordPress Extend Plugins as most people feel comfortable getting things from there. And that's great that you've developed it. I hope it helps lots of people.

    Posted 11 years ago on Tuesday May 14, 2013 | Permalink
  5. That's the plan... I just have to remember how to use SubVersion again and then I'll add it in.

    Once I've added it I'll post a link here if that's ok?

    Thanks,
    James

    Posted 11 years ago on Tuesday May 14, 2013 | Permalink