This support ticket is created hace 3 años, 4 meses. 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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
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: Asia/Hong_Kong (GMT+08:00)
Este tema contiene 11 respuestas, tiene 3 mensajes.
I have a lot of different date pickers and I need to be able to disable dates (or more accurately only allow dates based on a list [ from backend ajax])
I have tried :
var array = ["2021-07-14","2021-07-15","2021-07-16"]
$('input.hasDatepicker').datepicker({
beforeShowDay: function(date){
var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
return [ array.indexOf(string) == -1 ]
}
});
which should do the inverse of what I need, but nothing.
I have tried:
$( "input.hasDatepicker" ).datepicker({ minDate: -20, maxDate: "+1M +10D" });
but also does nothing.
I have even tried:
jQuery(document).ready(function(){
jQuery('input.hasDatepicker').datepicker('option','onClose',function(){
console.log('close');
});
jQuery('input.hasDatepicker').datepicker('option','onSelect',function(){
console.log('select');
});
});
Hello. Thank you for contacting the Toolset support.
As I understand - you want to disable the selection of specific dates on the date picker?
If yes, can you please share admin access details as well as on what page/post you added the datepicker field?
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I appreciate you are trying to help in the easiest way possible.
Should the code I've been trying work? Is what I'm trying to do possible?
Please provide code, there is no need for admin access.
You will have to target your field using CSS ID or CSS class if you do not know how to do it, that is why I will require admin access details so that I can review where you added the date picker field on what page/post and what dates you would like to hide.
You should try it first on your own and let me know if you will require further assistance.
Can you please answer some of the questions I have asked.
- Should the code I've been trying work?
- Is what I'm trying to do possible?
One of the code samples was from a Toolset post (as linked) but the jQuery('input.hasDatepicker') selector doesn't seem to work. (is present in the html).
I cant say anything until I check where exactly you are looking to apply the above code as there are lots of possibilities that code should not run as expected due to conflicts or as you shared even if code applied it could not work.
That is why its important for me to look at where exactly you are trying to apply the code and once I review that I'll be able to guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I see so rather than changing or updating the toolset datepicker instance, this is creating a new one and therefore this function needs to be added back in?
Above JS codes works fine in my localhost, since it is a custom JS codes problem, if you need more assistance for it, please provide a test site with the same problem, also point out the problem page URL and form URL, I need a live website to test and debug.
El debate ‘[Cerrado] disabling dates in the datepicker’ está cerrado y no admite más respuestas.