Arggh... this is still not working. Here's what I did:
1) I added this to functions.php:
[php]
/* Enqueue the date script in the paginated Gravity Form */
add_action('gform_post_paging', 'enqueue_mindate_script', 10, 2);
function enqueue_mindate_script($form, $is_ajax) {
// only add the min date script if we're on a page with form 2
if( 2 == $form['id'] ) {
// this assumes script is named mindate.js and in the child theme "js" folder. Dependency on jquery
wp_enqueue_script('mindate_script', get_stylesheet_directory_uri() . '/js/mindate.js', array('jquery'));
}
}
2) I created /js/mindate.js in my child theme with this code:
[js]
jQuery.noConflict();
jQuery(document).ready(function($) {
$( "#input_2_35" ).datepicker({ minDate: '+2d', gotoCurrent: true, prevText: '', showOn: 'both', buttonImage: '/wp-content/plugins/gravityforms/images/calendar.png', buttonImageOnly: true });
});
*All* dates are still available in the datepicker. I checked again to make sure the ID was right:
[js]
<li id='field_2_35' class='gfield' ><label class='gfield_label' for='input_2_35'>Please select a preferred date for your appointment.</label><div class='ginput_container'><input name='input_35' id='input_2_35' type='text' value='' class='datepicker medium mdy datepicker_with_icon' tabindex='29' /> </div><input type='hidden' id='gforms_calendar_icon_input_2_35' class='gform_hidden' value='http://www.redkitecreative.com/projects/ace/wp-content/plugins/gravityforms/images/calendar.png'/>
Could I have something wrong in my form settings?
Sorry for all the trouble, but if I can't fix this, I have to scrap hours of work and find something else. The client has to be able to restrict dates.
Posted 12 years ago on Tuesday August 21, 2012 |
Permalink