Calendar Date selector component

febbraro - June 28, 2006 - 01:57
Project:Webform
Version:6.x-2.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Hey everyone,

I needed a calendar/date component that was better than those dropdowns. I used the JSTools/JSCalendar module and I wrote a component that can be added to the webforms. I had trouble getting it to specify the format and afew other config parameters. Maybe I can work with you to figure out how to add it. Anyway. I attached the file, feel free to include it in CVS/releases if you like.

AttachmentSize
calendar.inc2.87 KB

#1

nedjo - July 24, 2006 - 20:34
Project:Javascript Tools» Webform
Version:HEAD»
Component:Jscalendar» Code

This looks like it's for the webform module rather than javascript tools.

#2

quicksketch - July 25, 2006 - 07:06

This looks pretty cool. I didn't know there was a JSCalendar module. Both the time and date components need a TLC to help them become more compatible with 3rd-party modules. The list of requested features for webform is getting a little lengthy, so I don't think I'll have time to put this together.

#3

quicksketch - August 27, 2006 - 08:42
Status:active» postponed

We have no plans to include the JS calendar into this release of webform. I'm planning on starting a 'new' webform which uses CCK fields instead of small customized solutions. The date.module already supports this functionality.

#4

pvasener - March 28, 2007 - 14:31

I used this component with my Drupal 4.7 version of Webform and it was completely fulfilling my needs. Now, as I intend to migrate to Drupal 5.0, is there a Drupal 5 compatible version of it available? It would also be great to have it as part of the supported components of the module.

#5

roczei - June 24, 2007 - 17:38

http://atlantis.ki.iif.hu/drupal/webform+jscalendar.drupal5.1.tgz

Here is the Drupal 5.1 version. :-)

calendar.inc (date+time)

calendar_date.inc (date)

Gabor

#6

johannes_db - November 11, 2007 - 19:20

Thanks a lot Gabor..
this is exactly what i was looking for but unfortunately it gives me an error with Drupal 5.3:

* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in D:\xampp\htdocs\aude\includes\database.mysql.inc on line 400.
* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in D:\xampp\htdocs\aude\includes\database.mysql.inc on line 400.

any thoughts on this?

best regards
Johannes

#7

rpmute - December 13, 2007 - 07:15
Version:» 5.x-1.7

bump. i'd really be interested in this too. just updated to 5.5. havent had a chance to do the include yet but i want the jscalendar functionality if at all possible.

#8

nedjo - December 17, 2007 - 23:37

There are no plans for a 6.x version of the JSCalendar module, as the original jscalendar library is no longer maintained. I believe a jQuery-based date picker was integrated into the Date package.

#9

madjoe - May 8, 2008 - 04:36
Version:5.x-1.7» 5.x-1.9
Status:postponed» active

Is it possible to use jQuery 'Date popup' with Webform yet?
I'll try to succeed with this and if you'd like to help me, please don't hesitate to drop me a line...

#10

quicksketch - May 9, 2008 - 04:48

No, this still isn't possible with Webform. We'd need to convert webform's date.inc to use #type = 'date' instead of 3 separate fields. This would also probably involve a database update to make date fields store as timestamps instead of individual values.

#11

quicksketch - May 9, 2008 - 04:53

Marked http://drupal.org/node/252609 as duplicate.

#12

jmesam - September 22, 2008 - 11:12

Why not integrate it with the Date popup module? It's based on jquery and there's another modules using it.

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/date/date_p...

#13

quicksketch - September 23, 2008 - 05:03
Version:5.x-1.9» 6.x-2.x-dev

An update on where Webform stands in regard to this request:

- Webform was refactored since my comment in #3, but CCK fields still aren't ready to be used by 3rd party modules, so no progress on that front.
- I've looked at the Date popup module before, but unfortunately it only works with plain-text fields (like the submitted date when editing nodes). This means that it operates differently than Webform's existing date.inc and cannot be used easily.
- I also looked into JS tool's popup calendar, but it operates in a way similar to the Date popup module and has been discontinued in Drupal 6.

So ultimately I'd still like to have a date popup, but no solution currently is available for Webform to use (easily).

#14

Gribnif - September 25, 2008 - 20:10
Status:active» needs review

Here's a patch to make webform's date element use date_popup. It essentially converts the separate month and date fields into a single text field on the way in, and parses them back out before returning control to the regular date field processing code. There are no changes to the way the data is stored in the the database.

The only down side to this is that it doesn't degrade gracefully. If the user's browser doesn't do Javascript, they will get a textfield instead of the nice selects that the date component normally uses. So perhaps this should be an option in the date component?

AttachmentSize
webform-date_popup.patch 5.15 KB

#15

quicksketch - September 26, 2008 - 02:47

Nice! Thanks Gribnif. Yeah, I've also noticed that date_popup doesn't degrade whatsoever, hence why I've avoided using it. The optimal solution would be a date popup that modifies the normal "date" component in Drupal (the one with 3 select lists for month/day/year).

I noticed YUI has support for this: http://developer.yahoo.com/yui/examples/calendar/formsel.html, and there's even a Drupal module that implements it: http://drupal.org/project/yui_calendar. Unfortunately it requires the YUI JS library, adding a bit of overhead and there isn't a jQuery alternative.

If this gets included, we'll definitely need to make in an option, rather than forcing it upon all elements. What does everyone else think?

#16

Gribnif - September 26, 2008 - 17:13

IMHO, it would be silly to add the overhead of a second JS library (YUI) for this feature. Also, unless it's just not this way in the demo, the YUI calendar isn't a popup. It always takes up a lot of real estate, because it's always visible.

It would be far better to rewrite the JQuery one to gracefully degrade the selects, rather than a text field. It might even be possible to do this by adding some JS, without modifying the JQuery calendar code at all.

#17

quicksketch - September 26, 2008 - 17:57

IMHO, it would be silly to add the overhead of a second JS library (YUI) for this feature. Also, unless it's just not this way in the demo, the YUI calendar isn't a popup. It always takes up a lot of real estate, because it's always visible.

I totally agree. I was just pointing out that YUI behaves mostly the way I'd like it to, unlike the the jQuery calendar.

It would be far better to rewrite the JQuery one to gracefully degrade the selects, rather than a text field. It might even be possible to do this by adding some JS, without modifying the JQuery calendar code at all.

I'd be really interested in this. I'd love if the "supported" jQuery calendar had this ability. If necessary, I also wouldn't mind making a "calendar.js" file to go along with the date component.

I also recalled another option, the excellent jCalendar plugin written by Ted Serbinski (m3averick) at http://tedserbinski.com/jcalendar/index.html, which works beautifully. Unfortunately he's stopped development on it because it's been deprecated in preference of http://plugins.jquery.com/project/jquery-calendar

#18

quicksketch - September 26, 2008 - 17:59

Oh, looks like jquery-calendar *does* support drop-down selects, with "a little bit of wiring" according to the demo site: http://ui.jquery.com/repository/latest/demos/functional/#ui-gen-9

#19

primerg - November 19, 2008 - 00:34

subscribing. do we have updates on this issue?

#20

khan2ims - November 27, 2008 - 12:58

Subscribing...

#21

ntg - February 6, 2009 - 12:07

Subscribing

#22

taxicab221 - March 22, 2009 - 02:59

Subscribing

#23

nelslynn - April 3, 2009 - 00:30

Subscribing

#24

Gerard - April 3, 2009 - 10:50

Subscribing

#25

drupalok - April 3, 2009 - 22:29

Subscribing

#26

jusyjim - April 6, 2009 - 17:51

subscribing

#27

jwinton - May 22, 2009 - 20:50

subscribing

#28

geraldferguson - June 16, 2009 - 22:55

yet another subscriber

#29

bocky - June 17, 2009 - 11:50

Subscribing...

#30

yanku - June 24, 2009 - 11:53

subscribing

#31

site_issues - July 10, 2009 - 23:13

subscribing

#32

jeffschuler - July 19, 2009 - 16:38

jQuery Calendar is now called jQuery UI Datepicker, and part of the official jQuery UI. I'm not certain whether multiple altField and altFormat options could be specified to tie the picker to multiple fields.

Keith Wood's fork/implementation, though, distinctly includes facilities for connecting the picker to multiple form elements: on http://keith-wood.name/datepick.html, click the Miscellaneous tab, and see the Linked to drop-downs example.

#33

jeffschuler - July 19, 2009 - 16:57

A suggestion to get this moving again...

It seems to me we're looking at 3 options for date selection, (which I'll name to show my bias:)

  • Fine: Text field for full date
  • Decent: Drop downs for Y, M, D
  • Best: Calendar picker

Since 95% of web users have Javascript enabled, I suggest we provide the Best functionality to that 95%, and degrade to Fine for the other 5% -- instead of just providing Decent for everybody.

So, we offload the picker functionality to Date Popup -- via Gribnif's patch -- then focus/consolidate efforts on helping Date Popup to degrade to Decent.

#34

haggins - July 19, 2009 - 21:23

subscribing

#35

chorrylan - July 26, 2009 - 04:30

subscribing

#36

jdlind38 - August 3, 2009 - 18:06

I'm also in need of a date popup solution for some fields in my webform...

#37

jeffschuler - August 5, 2009 - 00:33

Here is Gribnif's patch from #14, rerolled for the current Webform 6.x-2.x-dev.

It seems to work appropriately: provided the Date Popup calendar to me in a webform date field, and the dates I chose were correctly reflected by the form submission results.

This patch works for the 6.x-2.7 Webform release, as well.

AttachmentSize
webform-date_popup_2.patch 5.55 KB

#38

mcpuddin - August 27, 2009 - 19:11
Version:6.x-2.x-dev» 6.x-2.7

Patch worked great 6.x-2.7

Just make sure you install the Date module first (that is where Date Popup calendar comes from) http://drupal.org/project/date

#39

outbackbrazil - August 29, 2009 - 05:30
Category:feature request» support request
Status:needs review» patch (to be ported)

How do I get this patch(thread #37) integrated into the webform module?
Cheers,

#40

jeffschuler - August 29, 2009 - 05:58
Version:6.x-2.7» 6.x-2.x-dev
Status:patch (to be ported)» needs review

@outbackbrazil: the best way to help possibly get this change into Webform is to apply the patch in #37 to Webform 6.x-2.x-dev, (or 6.x-2.7,) test it out as thoroughly as you're able, and report back here on what you found.

"Patch (to be ported)" status is generally reserved for a patch that's been committed to a development version but needs to be backported to an earlier release.

Setting status and version back.

#41

animelion - October 12, 2009 - 05:04

I get a straight up WSOD after applying the patch in #37. I also made sure I had the Date and Date-Pop Up module enabled before hand.

#42

jeffschuler - October 12, 2009 - 15:38

@animelion: what version of Drupal, Webform, and Date?
Are you using JQuery UI?
Can you look at your webserver (& Drupal) error logs to see what the error was? -- Check out the WSOD diagnosis page.

#43

animelion - October 31, 2009 - 09:09

Sorry my setup has changed so much since then that I would not be able to re-duplicate that scenario.

#44

imclean - November 16, 2009 - 00:50

Applied patch from #37 to Webform 6.x-2.9 and all is working well so far. A very useful addition, thanks.

#45

imclean - November 18, 2009 - 03:06

One feature request (or perhaps 2). As quicksketch mentioned in #15, would it be possible to make this an option on a per-field basis? For e.g. I'd like a "Date of Birth" field to have the usual dropdowns.

Also, is it possible to change the default year range of 3 years either side of the current year? The year fields already exist in the configuration for the date field but the popup seems to ignore them.

#46

imclean - November 20, 2009 - 01:24

Here's a quick and dirty to allow date_popup to use the date range specified in the webform date field configuration. The following lines go in date.inc after it has been patched (#37), line 125 right after $form_item['#date_format'] = $date_format; :

<?php
   
// Get year range
   
$current_year = date('Y', strtotime('now'));
   
$form_item['#date_year_range'] = ($component['extra']['year_start'] - $current_year) . ':+' . ($component['extra']['year_end'] - $current_year);
?>

#47

mmenegon - December 4, 2009 - 04:47

Hi all,

Pretty new to all this, so apologies beforehand...

Tried to apply the patch with Webform 6.x-2.9 and got the following error:

Fatal error: require_once() [function.require]: Failed opening required './sites/all/modules/webform/components/date.inc' (include_path='.;C:\www\php\pear\') in C:\www\htdocs\drupal\src\drupal\includes\module.inc on line 262

Any help would be greatly appreciated...

M

#48

jasom - December 4, 2009 - 07:41

#37 works nice

 
 

Drupal is a registered trademark of Dries Buytaert.