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.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | webform_matrix_component-date_errors-2508009-7.patch | 739 bytes | joel_osc |
| #1 | screenshot-dk9u.ply_.st 2015-06-26 16-06-28.png | 204.48 KB | scottsawyer |
Comments
Comment #1
scottsawyerComment #2
quoffie commentedHi 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.
Comment #3
tassaf commentedSame error. anybody fixed that?
Comment #4
tassaf commentedI 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;
Comment #5
joel_osc commentedRan into the same issue - just a few missing variables for the webform_date_validator code. Here is a patch.
Comment #7
joel_osc commentedPatched one more error due to dates.
Comment #9
chetan-singhal commentedComment #10
oriol_e9gSame 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.
Comment #11
chetan-singhal commented