I am seeing this error notice on the edit page of a node with Fieldsets. In particular, if the fieldset has a description but no ID attribute, then I get the error.

Here is the message:

Notice: Undefined index: id in template_preprocess_fieldset() (line 217 of core/includes/form.inc).

It looks like the following code is the culprit. So I'm not sure if that's actually a core issue or an issue where the Field Group module needs to require an ID or provide a default one.

$description_id = $element['#attributes']['id'] . '--description';
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

inversed created an issue. See original summary.

inversed’s picture

Issue summary: View changes
Grimreaper’s picture

Version: 8.x-1.0-rc6 » 8.x-1.x-dev
Status: Active » Needs review
FileSize
2.53 KB

Hello,

I encountered the same issue. Putting an id when there is a description filled on the field group type settings fixed the problem.

So here is a patch that raises an error when setting a description but no id.

It also fixes the current ID and CSS class validation because in Drupal::formBuilder()->setError, there is no setError() method.

Thanks for the review.

amit.sharma.aust’s picture

Hi,

I had the similar issue but applying field_group-fix_settings_validation-2849759-3.patch solved my problem.

When I was creating general type content as developer, it was working fine. But when I was creating general type content as administrator, it was throwing following error on the create content page:

Notice: Undefined index: id in template_preprocess_fieldset() (line 217 of core/includes/form.inc).

And the cause of the error was description field of field_group. When I kept the description field of field_group empty it worked fine (even when I was logged in as administrator) but as soon as I put some description in it, it threw the error message.

Thanks for the solution.

geerlingguy’s picture

Status: Needs review » Reviewed & tested by the community

RTBC - this error was a bit annoying on any page where there was a Field Group with a description but no ID. The patch fixes the main issue. Alternatively, a patch could make the ID optional, but that would change the behavior of the module.

pdenooijer’s picture

Bug still exists but patch does not apply :(.

pdenooijer’s picture

Status: Reviewed & tested by the community » Needs work
Nebel54’s picture

Status: Needs work » Reviewed & tested by the community

The patch still applies for 1.x (dev and rc6) and works (when new field groups are created).

nils.destoop’s picture

I'm gonna ignore the patch and provide a fix. The user should not be forced to enter an id. We will generate an id if a description is available, but no id was set.

  • zuuperman committed a4bd386 on 8.x-3.x
    Issue #2849759 by Grimreaper: Undefined index: id in...

  • zuuperman committed 706ec56 on 8.x-1.x
    Issue #2849759 by Grimreaper: Undefined index: id in...
nils.destoop’s picture

Status: Reviewed & tested by the community » Fixed

Fixed on both the dev versions.

nils.destoop’s picture

Also committed your fix for the form errors when validating css classes.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.