Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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';
Comment | File | Size | Author |
---|---|---|---|
#3 | field_group-fix_settings_validation-2849759-3.patch | 2.53 KB | Grimreaper |
Comments
Comment #2
inversed CreditAttribution: inversed commentedComment #3
GrimreaperHello,
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.
Comment #4
amit.sharma.aust CreditAttribution: amit.sharma.aust commentedHi,
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.
Comment #5
geerlingguy CreditAttribution: geerlingguy at Acquia commentedRTBC - 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.
Comment #6
pdenooijer CreditAttribution: pdenooijer at Ibuildings commentedBug still exists but patch does not apply :(.
Comment #7
pdenooijer CreditAttribution: pdenooijer at Ibuildings commentedComment #8
Nebel54The patch still applies for 1.x (dev and rc6) and works (when new field groups are created).
Comment #9
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedI'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.
Comment #12
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedFixed on both the dev versions.
Comment #13
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedAlso committed your fix for the form errors when validating css classes.