I updated 5.x-2.3 to 5.x-2.4 (on a live site) and date-field handling seems to go broken.

I'm feeding default profile-module values to date field. Feeded values do not show up (instead of it I get Jan 1th 1970). More important is that user submitted date does not get saved anymore at all.

I'm getting a few hundred submissions this week, so this is an quite a acute problem... (and therefore critical prioritized).

Comments

rpsu’s picture

Priority: Critical » Normal

Recreating the whole form (instead just updating webform-module on old webforms) seems to correct this. Maybe there is still something to check? Down to normal-priority.

rpsu’s picture

Some testing later I got it:
1. Profile field of type DATE is not feeded into the form component also type DATE correctly. Instead of feeded value only January 1st 1970 shows up (ie. Unix timestamp "0").

2. Pagebreak-component is messing up component type DATE. For example user types a date on page #1, gives more stuff on a couple of pages - and the DATE value is lost somewhere between type and form submission. Removing pagebreaks solves this issue (or perhaps moving date-query to the last page? not tested..).

One can of course also use a few hidden fields to store this disappearing date, but this should work easier. I think it got broken in 5.x-2.4 (worked fine in 5.x-2.3).

Let the data flow again...

jazzitup’s picture

Title: Date handling seems to be broken » Date and time handling seems to be broken
StatusFileSize
new13.36 KB

Confirmed! Storing date fields is messed up for forms that includes page breaks. I've also noticed a funny issue with time! If you try to store a "single digit value" for hours (0-9), that number will be stored in the database correctly, but if you'll try to view your submission at node/X/submission/Y, the number won't appear in a combo box (take a look at the attachment).

Btw, I resubmitted the webform at node/X/edit AND node/X/edit/components right after I've finished with update.php.

yuit’s picture

Confirmed here as well. Very annoying, as I have multi-page forms with a large number of fields. It was working in 5.x-2.3 and the bug was apparently introduced in the 5.x-2.4 release.

jazzitup’s picture

Could you confirm this TIME issue as well?

yuit’s picture

I don't use the TIME type. Will check if I find a little moment to do so.

Re comment #1 above: recreating the whole form does not solve the problem in case of forms with pagebreaks.

jazzitup’s picture

Confirmed: recreating the whole form does not solve the problem in case of forms with pagebreaks.

rpsu’s picture

Yes, the issue is not (seems not to be) using Webforms created with 5.x-2.3 with a 5.x-2.4 version. Newly created webforms have the same issue. Tested and confirmed pretty thoroughly with Date-fields, but so far only majdoe has reported behavior with Time-field.

quicksketch’s picture

Priority: Normal » Critical

This was caused by #328528: Checkbox values in form_state rendered incorectly.. Apologies that this was not caught before releasing the new version. I believe it affects both Drupal 5 and Drupal 6 versions. This problem causes data loss, so I'm moving back up to critical.

Whiskey’s picture

I can confirm this also affects version 6.x-2.4

jazzitup’s picture

Is there any temporary workaround for this critical issue? Any suggestions?

TMSA’s picture

The referenced issue whose patch seems to have broken this (#328528: Checkbox values in form_state rendered incorectly.) ended up being patched with a one line change. If you remove / comment out that line the date handling seems fixed but you are back to the check box values in form_state being rendered incorrectly. This is a much less severe problem, though, unless there is some other bad behavior that I don't know about.

I am using 6.x-2.4. The offending line is line 1664 in the webform_client_form_submit function in webform.module:

  _webform_client_form_submit_process($node, $form_state['values']['submitted']);

Just remove that or comment it out.

TMSA’s picture

As always proceed with caution with my suggestion above. I am one person doing light testing and certainly not any official voice of the webform module. We are but mere acquaintances.

jazzitup’s picture

@TMSA #12: This approach seems to fix 5.x-2.4 issue as well.

A Time issue I've described previously is still present, but I doubt it's related with this Date issue.
I can receive an e-mail notification with the exact time and I don't see a problem in an e-mail report, but when I'd like to view the submission result online, the HOUR select field is set to it's default value: "hour".

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new2.49 KB

The problems introduced by #328528: Checkbox values in form_state rendered incorectly. are a bit difficult to overcome for types like date and time (where the submitted value is not the same as the saved value). However, it's definitely needed to keep checkboxes and grid components from loosing their values. The temporary work-around I've done is only have this processing occur on select and grid components, so things should work for those components while not breaking time and date. This is a pretty bad bug, I'm trying to get out a 2.5 release this weekend.

quicksketch’s picture

Title: Date and time handling seems to be broken » Date and Time Fields Loose Value in Multipage Forms
jazzitup’s picture

@quicksketch: Could you reproduce that "time issue" I've previously described? Date issue has gone, but Time issue is still present even with this patch on my Drupal page (patched 5.x.2.4 webform module)... the number (of hours) has been stored in the database perfectly correct each time after a submission, but the preview doesn't show the correct value.

jazzitup’s picture

Status: Fixed » Active

I still experience a strange Time issue and this time I've noticed that a value 00:15 (HH:MM) is not even being mailed correctly (I've received an empty value), but it's written in an adequate format within the database. If I'd like to view the submission, the same issue appears as described here in #3, #14 and #17. This bug is driving me crazy...

quicksketch’s picture

Status: Active » Closed (fixed)

Unless the time problem affects the Drupal 6 version of Webform, this will probably stay as "won't fix" (though that's not what I'm marking it because the original problem has been fixed). I haven't used Drupal 5 in 2 years now, it's time to upgrade.

Pete B’s picture

StatusFileSize
new649 bytes

Hello,

We were having the same issue as #3 -- 'If you try to store a "single digit value" for hours (0-9), that number will be stored in the database correctly, but if you'll try to view your submission at node/X/submission/Y, the number won't appear in a combo box (take a look at the attachment).'

This is caused by a bug in the function _webform_submission_display_time on line 210:

$form_item['hour']['#default_value'] = date('H', $timestamp);

This should read:

$form_item['hour']['#default_value'] = date('G', $timestamp);

I have attached a patch file against webform 5.x-2.9 which makes this change.

I haven't had time to test the drupal 6 version, but looking at the code suggests that this also affects webform 6.x-2.9

Thanks,
Pete

timdeeson’s picture

Status: Closed (fixed) » Needs review

Marking as needs review, esp. because potentially in 6.x-2.9 too.

quicksketch’s picture

Priority: Critical » Normal
Status: Needs review » Closed (won't fix)

This probably won't ever be fixed, support for Drupal 5 is now completely ended. I suggest upgrading to Drupal 6 and the 3.x version of Webform.