I'm going to add a title that is hidden as a workaround, but reporting to help with reducing possible notices.
This error is triggered twice on submission of the webform component, twice on insert, and probably on delete too, maybe. It may just be cast to an empty string on insert / update so it would just be a bung message instead.
drupal_set_message(t('Component %name deleted.', array('%name' => $component['name'])));
Notice: Undefined index: name in webform_component_update() (line 813 of sites\all\modules\webform\includes\webform.components.inc).
#662 webform_component_update(Array)
#1460 webform_component_edit_form_submit(Array, Array)
#859 form_execute_handlers('submit', Array, Array)
#376 drupal_process_form('webform_component_edit_form', Array, Array)
#131 drupal_build_form('webform_component_edit_form', Array)
[void] drupal_get_form()
#516 call_user_func_array()
#21 menu_execute_active_handler()
Notice: Undefined index: name in webform_component_edit_form_submit() (line 663 of sites\all\modules\webform\includes\webform.components.inc).
#1460 webform_component_edit_form_submit(Array, Array)
#859 form_execute_handlers('submit', Array, Array)
#376 drupal_process_form('webform_component_edit_form', Array, Array)
#131 drupal_build_form('webform_component_edit_form', Array)
[void] drupal_get_form('webform_component_edit_form', stdClass (object), Array, )
#516 call_user_func_array()
#21 menu_execute_active_handler()
So this is an issue with webform_component_insert() / webform_component_update() / webform_component_edit_form_submit() / webform_component_delete_form_submit() maybe other functions.
The cut-down definition was:
function coastal_webform_component_info() {
$component_info = array(
'user_details' => array(
'label' => t('User details'),
'features' => array(
'title' => FALSE,
'title_display' => FALSE,
'title_inline' => FALSE,
),
),
);
return $component_info;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | webform_component_defaults-1724518.patch | 6.83 KB | liam morland |
| #3 | webform_component_defaults-1724518.patch | 6.86 KB | quicksketch |
| #2 | webform_undefined_name_1724518.patch | 2.78 KB | liam morland |
Comments
Comment #1
alan d. commentedYep, no notices generated with delete messages
Comment #2
liam morlandPatch attached.
Comment #3
quicksketchI don't particularly like the idea of adding isset() checks all over the place. How about we just set a default value in webform_component_defaults()? Actually we could do this for all default properties and significantly trim down _webform_defaults_[component](). Even though things like a fieldset don't have a "value" or "mandatory" options, these end up getting set anyway when the component is written to the database.
Comment #4
liam morlandThat looks like a much better solution.
Comment #5
liam morlandI have re-rolled your patch, mostly taking care of changing "mandatory" to "required". I'm not getting the behavior I expected: I'm still getting "Undefined index: extra" errors, but I have not been getting the "Undefined index: name" error as in the original post.
Comment #6
quicksketchThis may have been affected by #2020705: Notice: Undefined index: name in webform_component_defaults(), I'm not sure. If we're still getting a different PHP notice now, does that make this still need work? I hadn't realized we were getting an undefined index "extra" at all. Does this happen under the same conditions as the original post?
Comment #7
alan d. commentedMmm... I appear to have stopped using coastal_webform_component_info() in that project, but is this simply a GIGO issue from using label rather than name in the original definition? If not replicable, happy if marked as fixed.
Comment #8
liam morlandI think you are right.