Skip Navigation

[Resolved] Datepicker

This support ticket is created 2 years, 11 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+00:00)

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by Puntorosso 2 years, 11 months ago.

Assisted by: Jamal.

Author
Posts
#2056031

Hi, I have created a date/time custom field with Toolset.
How can I restrict the datepick input to a date/time before "now"?
Thanks.

#2056127

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

The datepicker is from jQuery UI. You can use the maxDate option on it hidden link

Listen for the form's ready event, and apply the maxDate. Something like this should work:

jQuery(document).on('cred_form_ready', function() {
  jQuery( ".js-wpt-date" ).datepicker({ 
      maxDate: 0
    }); 
 });

The forum has several threads about the datepicker customization. Maybe they may help:
hidden link

I assumed that you are talking about a Toolset form. Let me know if it is not the case.

#2056189

Hi Jamal,
Thanks for the tip.
I was talking about a Toolset custom field on backend, assigned to WooCommerce orders.

#2056659

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Use the browser developer tools to get the name, id, or class of the field in the backend. Then use a plugin or custom code to add your Javascript code to the backend. https://wordpress.org/plugins/code-snippets/

Read more about jQuery selector here hidden link

Rely on the "ready" event:

jQuery(document).on('ready', function() {
  var selector = ".js-wpt-date";   // get the selector using the browser developer tools
  jQuery( selector ).datepicker({ 
      maxDate: 0
    }); 
 });

I hope this helps. Let me know if you have any questions.

#2056893

Hi Jamal,
I would need some help here, as I cannot get it work.

Would you be so kind to check this link and tell me which selector id I should use for the datepicker?
hidden link

Thanks.

#2057761

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Of course. Would you allow me temporary access to your website to check it closely? I tried to figure it out from my side, but I'll need to access the backend to better handle it. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#2065433

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.