Skip Navigation

[Escalated to 2nd Tier] Something is snowflakish about CRED DatePicker

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

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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 3 years, 5 months ago.

Assisted by: Waqar.

Author
Posts
#2072353

https://toolset.com/errata/toolset-forms-not-working-inside-elementor-pop-ups/ and https://toolset.com/forums/topic/datepicker-not-initialized-after-view-ajax-pagination/ have been detailed as expected "issues" due to "unusual approach" or "Compatibility issues" but in fact, I do not think this is the case.

Rather something is fishy abut the CRED Date Picker.

Why?

1. In the Elementor Pop Ups for example CRED Date Pickers fail. Not even re-instantiating the jQuery DatePicker on 'elementor/popup/show' will do the trick. However, as my tests show, that will work just fine if we insert a simple TEXT field in a CRED FORM and then $( ".date_test" ).datepicker(); that text field, still inside a Elementor Pop Up
2. Similarly, select2 cannot be instantiated on any CRED Select input when in Elementor Pop Up but it works just fine once we use elementor/popup/show even to instantiate the Select2 in CRED, which just proves that there is nothing weird about Elementor Pop Ups (or Views Paginations), but there is instead something weird with CRED Date Fields in particular.

For testing purposes use this approach:

1. Add a Date Field and a Select input to CRED Form
2. Add Cred Form to a AJAX paginated View and see how Date Field will already fail on ajax pagination which should, IMO, not just be discarded as a "edge case" but investigated and fixed.
3. Add CRED Form to Elementor Pop up and try to initialise Select2, you will notice that you need Elementor's hook here to be successful:

$( document ).on( 'elementor/popup/show' , function () {
		$('.whatever').select2();
	} );

It'll work just fine
4. Add CRED Form to Elementor Pop Up and try the same with date field. You will notice date field by default will be broken, and not even re-instantiating jQuery date picker in it will help
5. However now add SIMPLE TEXT GENERIC FIELD to CRED Form and then load that form in Elementor Pop Up and instantiate jQuery Datepicker like so:

$( document ).on( 'elementor/popup/show' , function () {
		$( ".whatever" ).datepicker();
	} );

That will immediately work.

So I think it is worth to revisit the CRED DatePicker field since there seems to be something weird about it, since we can clearly work with "normal" fields wether in Elementor Pop Ups or else, and successfully add JS to it, using Elementor Hooks, but we cannot do that with CRED Date Picker.

Let me know if it is unclear, thanks

#2072579

Hi Beda,

Thank you for contacting us and your observation is correct.

When it comes to the date-picker in Toolset date fields, it works differently from its default script-only implementation.

When you choose a date from the date-picker, an AJAX request is performed in the background that sends the selected date to the server to get back a timestamp, which is then added to a hidden field. This is why you'll also notice a slight delay between the selection of the date and its display in the field.

We have an internal ticket to improve this implementation so that this AJAX request part could be avoided. This will help in not only fixing what you've reported but will also end the extra delay.

I've added your voice to that ticket and will keep you updated.

regards,
Waqar