Title: Disable/block specific dates from datepicker?
Last modified: August 21, 2016

---

# Disable/block specific dates from datepicker?

 *  [icon](https://wordpress.org/support/users/iconoclastix/)
 * (@iconoclastix)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/disableblock-specific-dates-from-datepicker/)
 * Hi, I’m wondering if there’s any way to disable specific dates (either individually
   or via a range of dates) from within a datepicker field in a ContactForm7 form?
   I’m not sure if this functionality is already available within the plugin (if
   so, what is the correct syntax?) or if I would need a special script or other
   plugin in order to be able to do this…but any help would be greatly appreciated!
 * [http://wordpress.org/plugins/contact-form-7/](http://wordpress.org/plugins/contact-form-7/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [icon](https://wordpress.org/support/users/iconoclastix/)
 * (@iconoclastix)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/disableblock-specific-dates-from-datepicker/#post-4049482)
 * I found this code:
 *     ```
       <script type="text/javascript">
       	var unavailableDates = ["1-9-2013", "2-9-2013", "3-9-2013", "4-9-2013", "5-9-2013"];
   
       	function unavailable(date) {
       			dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
       			if (jQuery.inArray(dmy, unavailableDates) == -1) {
       				return [true, ""];
       			} else {
       				return [false, "", "Unavailable"];
       		}
       	}
   
       		jQuery(function() {
       			jQuery( '#dpick' ).datepicker({
       				dateFormat: 'dd MM yy',
       				beforeShowDay: unavailable
       		});
   
       	});
       </script>
       ```
   
 * and it seems to work fine in jsfiddle, but it won’t work when I put it on my 
   site. I added it in the header.php file just below the wp_head() call and just
   above the </head> tag (so it’s after the JS/jQuery libraries)…I’ve set it to 
   match the id on my datepicker field, but I’m still getting a JS error in console…
   can anyone help me out? Seems like it should be easy to get it working but I’m
   probably just missing some small formatting thing…

Viewing 1 replies (of 1 total)

The topic ‘Disable/block specific dates from datepicker?’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [datepicker](https://wordpress.org/support/topic-tag/datepicker/)
 * [disable dates](https://wordpress.org/support/topic-tag/disable-dates/)

 * 1 reply
 * 1 participant
 * Last reply from: [icon](https://wordpress.org/support/users/iconoclastix/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/disableblock-specific-dates-from-datepicker/#post-4049482)
 * Status: not resolved