When a date field is added to a matrix, errors, lots of errors.

Notice: Undefined index: #reference_timestamp in webform_expand_date() (line 249 of ___/___/___/sites/all/modules/webform/components/date.inc).
  Notice: Undefined index: #exclude in webform_expand_date() (line 327 of /___/___/___/sites/all/modules/webform/components/date.inc).
Warning: in_array() expects parameter 2 to be array, null given in webform_expand_date() (line 327 of /___/___/___/sites/all/modules/webform/components/date.inc).

There are 8 errors for each row added to the matrix, but they are all repeats of the ones listed above.

tested by:

  • removing all date fields from my form, no errors.
  • add a date field to the form ( not to the matrix ), no errors
  • add a date field to the matrix, errors!
  • remove date field from form ( keeping the field in the matrix ), errors!
  • remove date field from matrix, no errors
  • add date field to matrix, errors!

Webform modules installed:
Webform Webform (webform) Module Enabled 7.x-4.8
Webform Webform Matrix Component (webform_matrix_component) Module Enabled 7.x-4.16

Also receiving this when I edit the webform:
Notice: Undefined index: #webform_component in template_preprocess_webform_element() (line 3532 of /___/___/___/sites/all/modules/webform/webform.module).

Any ideas or recommendations? Is there a known issue with date fields in a matrix?

EDIT 2015-06-26:

I tested on simplytest.me with just the matrix form component, same errors. Screenshot attached. https://dk9u.ply.st/node

Also noticed that even though there are errors, the form can successfully be completed, but if you edit the response, it removes the dates. This is a pretty critical piece of a project I need to launch in 2 weeks, so any input would be fantastic.

Comments

scottsawyer’s picture

Issue summary: View changes
StatusFileSize
new204.48 KB
quoffie’s picture

Hi scottsawyer, were you able to fix the date issue ? I am having similar problem and I'd be glad to know how you resolved your issue concerning the errors with the date field.

Cheers.

tassaf’s picture

Same error. anybody fixed that?

tassaf’s picture

I did a temp solution for that by changing the $element values line 259 in webform_matrix_component.module to the following:

case 'date':
$datepicker = isset($elevalue['datepicker']) ? $elevalue['datepicker'] : FALSE;
$element[$prow][$i] = array(
'#type' => 'date',
'#title' => check_plain($title),
'#title_display' => $title_display,
'#required' => $required,
'#start_date' => !empty($elevalue['startdate']) ? $elevalue['startdate'] : '-2 years',
'#end_date' => !empty($elevalue['enddate']) ? $elevalue['enddate'] : '+2 years',
'#year_textfield' => 0,
'#default_value' => !empty($editvalue[$prow][$i]) ? $editvalue[$prow][$i] : $elevalue['default_date'],
'#timezone' => 'user',
'#process' => array('webform_expand_date'),
'#theme' => 'webform_date_matrix',
//'#theme_wrappers' => array('webform_element'),
//'#element_validate' => array('webform_validate_date'),
'#reference_timestamp' => NULL,
'#exclude' => array(),
'#datepicker' => $datepicker,
);
break;

joel_osc’s picture

Priority: Critical » Major
Status: Active » Needs review
StatusFileSize
new724 bytes

Ran into the same issue - just a few missing variables for the webform_date_validator code. Here is a patch.

Status: Needs review » Needs work

The last submitted patch, 5: webform_marix_component-date_errors-2508009-5.patch, failed testing.

joel_osc’s picture

Status: Needs work » Needs review
StatusFileSize
new739 bytes

Patched one more error due to dates.

Status: Needs review » Needs work

The last submitted patch, 7: webform_matrix_component-date_errors-2508009-7.patch, failed testing.

chetan-singhal’s picture

Status: Needs work » Closed (fixed)
oriol_e9g’s picture

Version: 7.x-4.16 » 7.x-4.x-dev
Status: Closed (fixed) » Reviewed & tested by the community

Same problem and the patch in #7 fixes the notices.

This bug is still present in 7.x-4.x, so still needs to be commited.

chetan-singhal’s picture

Status: Reviewed & tested by the community » Closed (fixed)