Needs review
Project:
Date picker formatter
Version:
6.x-1.0-beta1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Feb 2010 at 18:25 UTC
Updated:
12 Nov 2010 at 14:29 UTC
I think this is a bug - my usecase was:
Content type Doodle - why not use it for polls too? So I added a pollfield and thought that I can choose which one to use in "Edit".
But even when I don't enter a date in the date picker formatter field, one field will always show up in the resulting node (with an error, because no time given).
The field is not required, so when I don't select a date, no field should show up - at least that's how e.g. imagefield and a normal date field behave. Any idea...?
(Still a great module. I will quite certainly use it for my project!)
Comments
Comment #1
zeropaperOk, this might indeed be a bug needing further investigation.
could you post the content type definition? Would be handy for debug.
Have a nice evening (I guess we're on the same time zone ;) )
Comment #2
itsnotme commentedGuten Morgen ;) Thanks for reacting so fast. I tried to have a look into CCK fields but frankly, the code went way over my head.
Here the content types definition:
Comment #3
zeropaperok, got it.
I'll commit the change within few days.
If you're interested by the solution, I added a small check in the
theme_date_picker_formatter_formatter_date_picker_formatter($element)function, which now looks like:Comment #4
itsnotme commentedJust tested it. It stops the empty field from appearing...
...but unfortunately it also stops the valid fields from appearing.
Comment #5
zeropaperDamn it. I forgot to use my brain...
Should be ok.
Comment #6
itsnotme commentedYes, this looks very fine! Thank you so much!
I'll do some more testing here (alone and in combination with Pollfield) before I implement it in my Intranet, so if I come across anything else, I'll drop a note.
(And in case you'll attend the Drupalcamp in Essen - you're invited to a drink :)
Comment #7
zeropaperI wish I could come to Essen ;( but I can't afford myself a ticket and I'm overloaded with work (RESET.to goes India very soon)...
Whatever, feedback will always be welcome.
Have a nice day
Comment #8
itsnotme commentedSorry to hear about Not!Essen :(
I think I found another little bug - when only one valid field is added, it's still not shown. (Okay, it makes no sense to add just one Doodle date, but I guess it's unintentional to filter that).
Comment #9
itsnotme commentedThe bug that a single doodle field is not displayed can be fixed by correcting line 442 (I hope that's the right line for everyone):
if (count(element_children($element)) <= 1 || date_content_is_empty($first_item, $field)) {to
if (count(element_children($element)) < 1 || date_content_is_empty($first_item, $field)) {A simple <= to < makes all the difference here :) Thanks again for the cool module.
Comment #10
socialnicheguru commentedsubscribing. this little fix works! Thanks!
Comment #11
inak commentedfound another solution which will fix it directly at the beginning (added another condition to the if clause, and initialized the form):
around Line 178:
Comment #12
thepanz commentedIs this issue still valid for 2.x branch?