I have used the gform_post_render function in Gravity Forms to create a custom datepicker using the minDate option for selection of 1 day in advance:
http://www.gravityhelp.com/documentation/page/Gform_post_render
Is there a way that I can exclude weekends? I only want the user to be able to select weekdays with one day ahead. I have tried using the beforeShowDay: $.datepicker.noWeekends
but that seems to conflict with minDate
Here is my form: http://www.discountdumpsters.com/shop/30-yard-dumpster/
And here is my code:
<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
jQuery("#input_1_1").datepicker({ defaultDate: '+1d', minDate: '+1d', gotoCurrent: true, prevText: '', showOn: 'both', buttonImage: 'http://www.discountdumpsters.com/wp-content/plugins/gravityforms/images/calendar.png', buttonImageOnly: true });
});
</script>
Any help would be appreciated…thanks!
I think you must enqueue your script in the footer and not in the head
actually I’ve used your code on an external js file and it’s working even with the noweekends declaration
Realized I never answered this question. Here is the final code that worked for me: