Skip Navigation

[Resolved] Datepicker disable date

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 6.86 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 8 replies, has 2 voices.

Last updated by Anonymous 7 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#571145

Anonymous

Hi, I have a datepicker in which I want to disable some dates, in particular all the months excluding january, february, march and april.
I found this reference hidden link
And I want to change it to work with months.
What I don't know is where to put the code etc

#571173

If the datepicker is in a View, you can add the raw JavaScript code to the View editor's JS panel. If the datepicker is in a CRED form, you can add the raw JavaScript code to the CRED editor's JS panel. The JS code will then be included on any page containing that View or CRED form. Did you need to use PHP to output the JavaScript in the page source for some other reason?

A few notes:
- In a View, you can use the document ready event handler to invoke your custom code. The jQuery object can be accessed using jQuery instead of $.

jQuery(document).ready(function(){
  // your view jquery code here using jquery instead of $
});

- In a CRED form, document ready happens too soon. You should wait for the 'cred_form_ready' event to be fired on the document object:

jQuery(document).on('cred_form_ready', function() {
  // your cred form jquery code here using jQuery instead of $
});
#571275

Anonymous

No, it isn't in a view or cred, it is a Contact Form 7.
I'm not a coder and in particular I have no skills with javascript and the only place I saw in WordPress to put some js code wan in Toolset Views.
But probably I'd better have to put it into functions.php but I don't know how so I don't know how to disable some months other way.

#571453

How does Contact Form 7 implement datepickers? Can you show me a link to their documentation?

#571471

Anonymous

This is the documentation
hidden link
This is my datepicker

[date* data-nascita-primino max:today-5years id:someid ]

I think that a code like that should work but it doesn't, if I put it into the form

<script>
jQuery(function($){
  ​$("#someid").datepicker({
    beforeShowMonth: function(date) {
      var month = date.getMonth();
      return [(month != 5 && month != 6 && m && month != 7 && month != 8 && month != 9 && month != 10 month != 11 && month != 12)];
    }
  })​​​​​;​
});
</script>
#571473

Where does their documentation mention jQuery datepicker? I don't see anything about it here. They may not use jQuery datepicker.

#571478

Anonymous

I also found this.
hidden link

But validation doesn't disable dates, only check if selected date is valid?

It could be a compromise but I don't know how to use that code in validation

#571529

It sounds like you need assistance programming some custom validation on a form that is not a CRED form. Contact Form 7 is not Toolset software, and I'm not really qualified to help you set up custom validation on their forms. If you have a question about how this should be implemented, Contact Form 7 is best suited to help you with that.
hidden link

#571838

Anonymous

ok