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.

Disable days in datepicker

  1. Im using gravity forms in wordpress, i am using the date field for delivery and would like to disable todays and next date. how couldi achieve this? thanks
    i tried adding this into html field but did not help. found this online
    <script type="text/javascript">
    jQuery(document).bind('gform_post_render', function(){
    // destroy default Gravity Form datepicker
    jQuery("#input_1_1").datepicker('destroy');
    // create new custom datepicker
    var oneWorkingDays = new Date();
    var adjustments = [0, 1, 1, 1, 1, 1, 0]; // Offsets by day of the week
    oneWorkingDays.setDate(oneWorkingDays.getDate() + 1 + adjustments[oneWorkingDays.getDay()]);
    jQuery("#input_1_1").datepicker({ beforeShowDay: jQuery.datepicker.noWeekends, minDate: oneWorkingDays, gotoCurrent: true, prevText: '', showOn: 'both', buttonImage: 'http://www.discountdumpsters.com/wp-content/plugins/gravityforms/images/calendar.png', buttonImageOnly: true });
    });
    </script>

    Posted 12 years ago on Tuesday December 4, 2012 | Permalink
  2. Anyone can help me with this please?

    Posted 12 years ago on Wednesday December 5, 2012 | Permalink
  3. Do you have a link to your form?

    Posted 12 years ago on Thursday December 6, 2012 | Permalink
  4. balijuice.ca/shop/upick-pack

    Posted 12 years ago on Thursday December 6, 2012 | Permalink
  5. Hi Masterok, I noticed that you got disabling of today and tomorrow working on your site at http://balijuice.ca/shop/upick-pack/. Can you please share your solution? I have the same task.

    Thank you,
    Anton

    Posted 12 years ago on Wednesday January 23, 2013 | Permalink
  6. You can see the JavaScript in the source of the page. Looks like they used this function over and over for multiple datepicker fields:

    <script type="text/javascript">
    jQuery(document).ready(function($) {
    $( "#input_3_8" ).datepicker({ firstDay: 1, defaultDate: '+0d', minDate: '+2d', maxDate: '+2y', gotoCurrent: true, prevText: '', nextText: '', showOn: 'both', buttonImage: 'http://balijuice.ca/wp-content/plugins/gravityforms/images/calendar.png', buttonImageOnly: true });
    });
    </script>

    I copied the full code here: http://pastebin.com/XSmbicwv

    Posted 12 years ago on Wednesday January 23, 2013 | Permalink
  7. Hi Chris,

    thank you for your help!

    Best regards,
    Anton

    Posted 12 years ago on Wednesday January 23, 2013 | Permalink
  8. You're welcome

    Posted 12 years ago on Wednesday January 30, 2013 | Permalink

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