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.

Calendar - does the date picker (still) allow users to pick dates in the past?

  1. pming
    Member

    I think there's an existing topic about this, but I can't access it since my license has expired.

    I'm planning to renew my license, but I want to know first if this issue still exist or if there's a way to keep users from picking dates in the past.

    Posted 11 years ago on Wednesday January 23, 2013 | Permalink
  2. There is a way to do it. It requires adding JavaScript (jQuery) to the page where your form is embedded to restrict the date range. It's not a feature of Gravity Forms, but you can control all the options of the jQuery UI Datepicker. They are documented here: http://jqueryui.com/datepicker/

    Posted 11 years ago on Wednesday January 23, 2013 | Permalink
  3. This JavaScript added to the head section of the page where the datepicker is in use will prevent any past dates from being selected:

    <script type="text/javascript">
    jQuery(document).ready(function($) {
        $(".datepicker").datepicker({ minDate: 0 });
    });
    </script>
    Posted 11 years ago on Wednesday January 23, 2013 | Permalink
  4. Hey - this is great, just what I was looking for! However, I notice that this doesn't prevent people from typing in what they want. Only the calendar tool is restrcited. Any ideas about blocking the field so that users are forced to use the calendar?

    cheers!
    -jennyb

    Posted 11 years ago on Monday March 25, 2013 | Permalink
  5. To prevent the user from typing into the field, you can make it readonly. See this suggestion: http://stackoverflow.com/a/4164627

    Here is how you can make any field in Gravity Forms "read only":
    http://www.gravityhelp.com/forums/topic/non-editable-text-field-request#post-151024

    Posted 11 years ago on Monday March 25, 2013 | Permalink
  6. Rock n roll! That did it, thank you so much! :D
    -jennyb

    Posted 11 years ago on Monday March 25, 2013 | Permalink
  7. You're welcome.

    Posted 11 years ago on Tuesday March 26, 2013 | Permalink

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