jscalendar pops up when selecting autocompletion dropdown option

victorkane - February 4, 2007 - 10:37
Project:Javascript Tools
Version:5.x-1.x-dev
Component:Jscalendar
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

If I set up a freetagging vocabulary only for page, or story, and use autocompletion upon editing a page or story, all is well.
I now set up a new content type, and apply the freetagging vocabulary to that type.
Editing it and using autocompletion, all is well.
I now add a (totally new, unused in any other content type) date field to the content type (export attached in file export.txt). I use the select list widget (any actually) and leave absolutely all options default.
Now when I want to create a new content item using the new content type, and I press enter on one of the autocompletion dropdown list items, the jscalendar appears in a weird transparent manner in the upper left hand corner of the page.
This has been going on for quite some time (ever since rc2 of Drupal 5, and the corresponding drupal release and module updates). I always assumed it would just go away with the other bug fixes and enhanced releases the views and cck and date modules were undergoing, but it hasn't.
Before posting this bug report I updated to Drupal 5.1, and updated absolutely all modules to their most recent stable release.
CCK: 5.x-1.3
Date: 5.x-1.2
Views: 5.x-1.5
jstools: 5.x-1.3 (been going on forever, though).
Calendar: 5.x-1.2
daterange: 5.x-1.2

AttachmentSize
export.txt1.69 KB

#1

yched - February 4, 2007 - 14:35

This is most probably an issue for jstool / jscalendar. Not a cck issue anyway. Karen, what do you think ?

#2

victorkane - February 4, 2007 - 16:33

It may be an issue for jscalendar, but note that in the issue I am raising, autocompletion and jscalendar are totally compatible outside of a cck context with a date field.
The bug occurs only when a date field is used as an additional CCK field (even when the date field doesn't use the jscalendar widget!).

#3

yched - February 5, 2007 - 02:02
Project:Content Construction Kit (CCK)» Date
Version:5.x-1.3» 5.x-1.2
Component:content.module» User interface

True. Then the entry point is probably date.module

#4

KarenS - February 8, 2007 - 16:14

I am unable to replicate this on the latest code (I'm not testing stable releases, I'm testing latest cvs version). There were a number of problems getting jscalendar working right with the Date field in 5.x, so possibly it has been fixed since you tried it. Can you still reproduce the problem with the latest cvs of everything?

Also, I notice you are using the daterange module and it is conceivable that is where the problem lies (it interacts with CCK dates) so try disabling that. Also make sure you don't have any views blocks enabled just to be sure there is no block code producing the problem.

#5

victorkane - February 9, 2007 - 12:39

Thank you so much Karen, for such a detailed set of suggestions.
Unfortunately, no luck for me, at least.
On my Drupal 5.1 Sandbox, I first disabled the daterange module, then erased it completely for good measure. I erased cache then disabled the devel module, so it had no block running, and I disabled the more esoteric of the jstools modules.
I disabled date, saved configuration, then enabled date again (to make sure cache was erased).
The only block remaining was the navigation block.
I then took the story node and gave it a date field with the drop down widget (not even the jscalendar widget).
Upon performing create content, upon attempting to apply a vocabulary term (which uses autocompletion), as soon as the selection dropped down and I selected with my mouse and pressed enter, up popped the darn jscalendar in the upper left hand corner of the browser.

I then disabled the date module, saved configuration, and erased it completely, went to first page.
Then I CVS'd the latest version of the DRUPAL-5 branch of your module (which has yesterday's date on the date.module file, Feb 8, so I think I am right in assuming this is what you meant by "the latest cvs" (please tell me if I should try with a different branch).

I wound up with the same files in the date module subdirectory as can be found at http://cvs.drupal.org/viewcvs/drupal/contributions/modules/date/?only_wi... (after selecting DRUPAL-5 branch for good measure).
I enabled the date module again.

But when I create a story with a date field, even though it is not using the jscalendar widget, the jscalendar continues to pop up when I select a vocabulary term using autocomplete (once again: type in a single letter, let the drop down list of terms appear, select with arrow keys or the mouse, then press enter).

I will try this again this evening (in about eight hours) on an absolutely fresh install, as well as on other systems I have running, and will report back then.

Once again, thanks so much for taking the time to help on this annoying problem.

#6

victorkane - February 9, 2007 - 12:44

Sorry for not having detected this sooner: the jscalendar "ghost" pops up _only_ when I press enter on the vocabulary autocompletion field. At any time I press enter there. Actually, if I use my mouse for selection, the problem does not occur.

But it always occurs (even if I go off and enter data in another field, then select the vocabulary autocompletion field and press enter, then it pops up) when I press enter on that field.

#7

KarenS - February 9, 2007 - 13:17

This could still be a jscalendar bug, but let's dig into it. Pull up the source code of the page with the problem. Jscalendar works by operating on a form element that has the 'jscalendar' class, so if you're getting it on your page, you must have some form field with that class. Figure out what field it is and which module that field belongs to and we're starting down the path of figuring this out.

#8

victorkane - February 9, 2007 - 20:01

Thanks so much, Karen!
Well, the culprit seems to be the Authoring information fieldset:

<fieldset class=" collapsible collapsed"><legend>Authoring information</legend><div class="form-item">
<label for="edit-name">Authored by: </label>
<input type="text" maxlength="60" name="name" id="edit-name"  size="60" value="victorkane" class="form-text form-autocomplete" />
<div class="description">Leave blank for <em>Anonymous</em>.</div>
</div>

<input class="autocomplete" type="hidden" id="edit-name-autocomplete" value="http://mentor/drupal/user/autocomplete" disabled="disabled" /><div class="form-item">
<label for="edit-date">Authored on: </label>
<input type="text" maxlength="25" name="date" id="edit-date"  size="60" value="" class="form-text jscalendar" />
<div class="description">Format: <em>2007-02-09 19:45:11 +0000</em>. Leave blank to use the time of form submission.</div>
</div>
</fieldset>

I am attaching the source code for the editing of a common story content type with a single date field (drop down widget) added with CCK.

I have discovered that with this add story, if I press Enter in absolutely any field, the jscalendar pops up.
If I do the same with add off-the-shelf page, this does not happen at all.

It probably is jscalendar's "fault" in that it seems to be very confused :)

But it only happens with date.

I will continue also to try to figure this out.

Thanks again!

AttachmentSize
story.htm_.txt 19.96 KB

#9

KarenS - February 15, 2007 - 22:33
Project:Date» Javascript Tools
Version:5.x-1.2» 5.x-1.x-dev
Component:User interface» Jscalendar

I'm moving this since it seems like it must be a jscalendar bug. It is showing up on a page where the date module is not even adding any jscalendar classes to the form. They can move it back if they think the date module is doing something to cause this.

#10

nedjo - February 16, 2007 - 05:13
Status:active» fixed

Yes, this was a bug in the module. I found the key to solving it in this post: http://www.dynarch.com/forums/1609. The fix: change the datepicker's element type from button to div.

#11

victorkane - February 16, 2007 - 15:55

Thanks nedjo!
When it rains it pours!

Karen is quite right that it is a jscalendar module problem (or solution) after all.

Last night at our monthly Buenos Aires Drupal Users Group meeting, vanveen@drupal.org (Leonardo) said he also had solved the problem, and posted a very similar solution to the Argentina group at g.d.o: http://groups.drupal.org/node/2804

Here is a translation to English of Leonardo's workaround (using span instead of div):

"In answer to a doubt of Victor's"

During today's meeting, which was very enjoyable and productive, I found out that Victor had run up against a problem that I had also encountered and had to solve at one time.

The problem arises when using the jscalendar module (part of jstools) to obtain a beautiful dynamic calendar as an input device for date fields. The question is that a keypress with the Enter key in any other field in the form displays the calendar, when no-one needs it...

I found that the problem resides in the fact that the little button the module inserts next to the text field where the date is to be input is, precisely, an input of type button. And the button traps the enter event, even when the Enter key is pressed in a totally different place in the form.

So the solution reduces itself to changing the button for another kind of element. I used a span.

The change must be made in jscalendar.js, line 8:
var button = document.createElement('button');

change this for:

var button = document.createElement('span');

Simple. So, Victor had the same problem, I hope this little workaround is useful for more people also.

#12

Anonymous - March 2, 2007 - 16:00
Status:fixed» closed

#13

ThyBzi - June 18, 2009 - 13:35

Thanks for the solution. As for me, I just used <input type="button" value="..." id="date_trigger" /> instead of <button id="date_trigger">...</button>. Not div, and not span, because input element at this case provides just the same outlook that button element is providing (no need to style that element).

 
 

Drupal is a registered trademark of Dries Buytaert.