jQuery 1.2 compatibility for Date Popup

kullerkeks - July 10, 2008 - 10:53
Project:jQuery Update
Version:5.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi Wim!

When I use HS3 in a content type, that has a CCK date fields, the date picker (Date Popup, current Date API 5.x-2.x-dev) is not showing anymore. When I disable HS for this content type, the date picker popup is working again.

So it seems there is a conflict between HS3 & Date Popup?

Please help - I love & need both modules HS3 AND Date Popup! :)

Cheers, Simon

#1

Wim Leers - July 10, 2008 - 10:57
Title:Conflict with Date Popup (Date API 5.x-2.x-dev)» jQuery 1.2 compatibility
Project:Hierarchical Select» Date
Version:5.x-3.x-dev» 5.x-2.x-dev
Component:Code - Taxonomy» Date Popup

I think Date Popup is not yet compatible with jQuery 1.2 then.

Moving to the Date queue.

#2

kullerkeks - July 11, 2008 - 09:08

The point is, that Date Popup works fine also with jQuery 1.2.x but it stops working as soon as HS3 is active at the same page.
It really seems that there is some kind of javascript conflict between the two modules??!

#3

KarenS - July 11, 2008 - 12:00

There is a newer version of the jquery calendar popup that I haven't had time to incorporate yet. It has a different API, so I'll have to both get it updated and make changes in the way the code works. Maybe that one will get around the conflicts? I don't know what else to suggest.

#4

KarenS - August 8, 2008 - 14:48
Title:jQuery 1.2 compatibility» Date Popup conflict with Hierarchical Select

The newer version won't work out of the box with Drupal 5, so I had to stick with the current version. The new version works requires jQuery 1.2 and works fine in Drupal 6. However, I was able to get the older version working in Drupal 6, which uses jQuery 1.2, so I don't think that is the issue. I could get the older version (the one used in Date 5.2) working with either version of jQuery.

I don't know enough javascript to figure out what the conflict would be, help would be appreciated.

#5

Wim Leers - August 8, 2008 - 15:18
Title:Date Popup conflict with Hierarchical Select» jQuery 1.2 compatibility for Date Popup
Project:Date» jQuery Update
Version:5.x-2.x-dev» 5.x-2.x-dev
Component:Date Popup» Code

This is exactly what I was afraid for when I updated it to jQuery 1.2. But it seemed most modules were already compatible! So I went ahead with it.

Moving to the jquery_update module because it's thanks to them that all modules have moved on to jQuery 1.2. They seem to have done compatibility updates at crazy speeds, so I'm moving it to that issue queue

#6

phonydream2 - September 3, 2008 - 21:18

Subscribe

#7

realityloop - September 28, 2008 - 03:52

subscribe

#8

mackh - October 9, 2008 - 02:50

subscribe

#9

ianchan - October 10, 2008 - 00:12

subscribe

#10

Taras Zavaliy - October 13, 2008 - 11:26

subscribe

#11

jdotti - October 21, 2008 - 12:01

subscribe

edit :
But i don't understand why is it a jquery update issue since it is working correctly (jquery update 5.x-2.0 and jQuery 1.2 ) except HS module is enable.

#12

realityloop - October 21, 2008 - 21:27

jdotti: I agree, disabling HS allows the date picker to function as normal which is why I initially posted the issue in the HS issue queue.

#13

thesaunterer - October 25, 2008 - 01:44

Same issue here.

#14

tanjerine - November 4, 2008 - 07:50

subscribing

#15

pivica - November 5, 2008 - 08:48

Hi guys,

Same problem here - using date_popup 5.x-2.3 with hierarchical_select 5.x-3.0-rc6 on the same page is resulting that date_popup is not working.

After some investigation (but please mind that i ma not js expert) I think that problem is actually caused by effects.core.js that hs is using - when I disabled effects.core.js date_popup started to work - so definitly this is js problem.
I tried to update effects.core.js to last version but that didn't help, date_popus still not worked.

Then I noticed that date_popup is using relatively old ui.calendar.js. After replacing ui.calendar.js with new ui.datepicker.js and quick hacking of date_popup.module everything finally worked :)

So I guess that problem is compatibility between ui.calendar.js and effects.core.js.
New version of date_popup for drupal 6 is using ui.datepicker.js, so when hs get version 6 there should not be any problem. In the mean time I dont know what would be a good solution for 5.

#16

jdotti - November 5, 2008 - 13:39

Hi privica,

Where did you find the ui.calendar.js and how do you hack date_popup.module ?

Thanks in advance for your answer.

JD

#17

pivica - November 7, 2008 - 19:13

Hi jdotti,

> Where did you find the ui.calendar.js

ui.calendar.js is in date/date_popup/lib/ui.calendar.js

> and how do you hack date_popup.module ?

Basically i downloaded latest ui.datepicker.js and apropriate css from http://ui.jquery.com/, copied it in date_popup and then hacked a little bit date_popup.module so datepicker is used instead of calendar js.

I see that people are interested in this so today i invested little more time and fixed date formatting so it should be now compatible with datepicker js - that means that you can configure input and output view of date through regular date_popup field configuration. Tested a little bit everything and it seems its working ok.

I don't have time for now to create patch for dev version of date_popup - first i don't know is it needed anyway because we are all slowly moving to d6. So I just attached complete hacked date_popup module - just unpack it and copy it over original date_popup 5.x-2.3, and with little luck it should work - remember to clear cache first if its not working.

Couple of notes:
- This is working for me ok, but i didn't test it much, so test everything before thinking to install this on your prod server.
- You can change theaming of date control easily - just go to http://ui.jquery.com/themeroller create custom theme, download it and replace themes/jquery-ui-themeroller.css file.
- Maybe layout of new date control will not be ideal at first (at least it wasn't for me - datepicker was to width) but with little change in your theme css file it should be easy fix.
- I didn't test how my changes are working with time control - but i think that date and time controls are totally separated so there should not be any problem.

Hopes this will help you.

AttachmentSize
date_popup_5.2.3-with_datepicker.zip 55.92 KB

#18

realityloop - November 9, 2008 - 22:41

A big thanks to pivica for this!!

Works great for me.

#19

ianchan - December 11, 2008 - 19:20

update from #17 worked for us for 5.23 but stopped working for 5.25.

I've almost updated a version of the fix from #17 to work for 5.25. However, I'm running into a problem with placing the separator back into the formatted date.

What happens is:
1. click field
2. popup displays
3. select date
4. "12112008/" is inserted to the field instead of "12/11/2008"

It looks to me like this function (around line 473) isn't being called.

/**
* Reconstruct popup format string into normal format string.
*
* @param string $format
*   a string in popup format, like YMD-
* @return string
*   a normal date format string, like Y-m-d
*/
function date_popup_popup_to_format($format) {
  $sep = substr($format, -1);
  $parts = array();
  ereg('(mm)(dd)(yy)', $format, $parts);
  return implode($sep, $parts);
}

When I remove the above function the popup module still works (without the correct separators).

My question:
Where was date_popup_popup_to_format called from in version 5.23 of the date module?

#20

iam_himanshu - March 12, 2009 - 13:02

subscribing...

#21

aac - March 29, 2009 - 05:44

Subscribing!!

#22

MMachnik - June 10, 2009 - 01:08

I just added this note to a similar issue:

http://drupal.org/node/259681#comment-1684828

In short if you have JS Calendar enabled, try disabling it and see if that helps. It did work for me. I did not have HS but still had the problem with no days appearing in the Date Popup.

#23

lunarbear - July 24, 2009 - 10:13

subscribing

#24

drenton - September 9, 2009 - 18:53

I changed the speed from immediate to normal in the date_popup.module and now everything seems to work fine. We are using Date 2.7.

Line 236 was changed from :

"speed: 'immediate', \n".

to

"speed: 'normal', \n".

#25

k4ml - September 17, 2009 - 06:17

I'm having this problem too today after upgrading to 5.x-2.8. The popup suddenly didn't appear. Applying #24 make it work again.

 
 

Drupal is a registered trademark of Dries Buytaert.