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.

trouble implementing date picker restriction

  1. Hey there,

    I'm in the midst of building a site located here:
    http://mix4tv.com/submit-your-project/

    The specific action I'm trying to take is to make the date picker restrict the available inputs to only today plus 2.

    I've found the following threads, but still haven't been able to get this working:
    http://www.gravityhelp.com/forums/topic/date-picker-restriction-dates

    in that thread, the user actually did implement his restriction exactly as I want mine to work. I tried copying his code into an html block in my form, but it seemed to have no effect.

    I AM able to get the date field to convert to read only using a javascript in an html block later in the same form, so I feel like my placement of the code is correct - the issue may just be what the code actually says.

    I then found this thread:
    http://www.gravityhelp.com/forums/topic/date-picker-excluding-todays-date#post-84682

    and pasted the code from the first thread referenced into a date_restriction.js file and placed it into a /js folder in my child theme. When I attempted to paste the gform_enque into my I functions.php file (after changing it to reflect my form id) still got no effect.

    It seems like this should be simpler than it is. :)

    any help appreciated.

    thanks!

    Posted 11 years ago on Tuesday April 9, 2013 | Permalink
  2. still looking for help here.

    Posted 11 years ago on Tuesday April 16, 2013 | Permalink
  3. David Peralty

    Can you just wrap the JS in the header of your child theme so it shows up as I don't see the JS currently being included on the page?

    Posted 11 years ago on Tuesday April 16, 2013 | Permalink
  4. Hi David,

    I've just added the JS to my child theme. Still not working. Looks like this:

    '<?php wp_head(); ?>

    <script>
    jQuery.noConflict();
    jQuery(document).ready(function($) {
    $( "#datepicker" ).datepicker({ minDate: '+2', gotoCurrent: true, prevText: '', showOn: 'both', buttonImage: '/wp-content/plugins/gravityforms/images/calendar.png', buttonImageOnly: true });
    });
    </script>

    </head>'

    thanks for any help!

    Posted 11 years ago on Wednesday April 24, 2013 | Permalink
  5. David Peralty

    Can you try:
    $( "#input_1_14" ).datepicker ...

    Posted 11 years ago on Wednesday April 24, 2013 | Permalink
  6. ah, perfect! that did the trick. Thanks for the help there.

    Was that change just to point the command to the specific form?

    Posted 11 years ago on Wednesday April 24, 2013 | Permalink
  7. David Peralty

    It was to point it to the field element. You were pointing to an ID that didn't exist. :)

    Posted 11 years ago on Wednesday April 24, 2013 | Permalink

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