This problem looks similar to #1436840: The module is not saving multiple field group entry

When I enter multiple rows and then preview the record, I get errors:

Notice: Undefined index: field_recommendation_type in field_group_multiple_field_group_pre_render() (line 169 of C:\Users\Adam.Browne\Sites\wce2\sites\all\modules\field_group_multiple\field_group_multiple.module).
Warning: Invalid argument supplied for foreach() in element_children() (line 6244 of C:\Users\Adam.Browne\Sites\wce2\includes\common.inc).
Warning: Invalid argument supplied for foreach() in field_group_multiple_field_group_pre_render() (line 180 of C:\Users\Adam.Browne\Sites\wce2\sites\all\modules\field_group_multiple\field_group_multiple.module).

If I save the record, none of the data displays - all I see is the label

If I open the record again to edit the node, all the fields are still full. and I see the error message above.

I've attached a screenshot of the edit fields - it's just 3x text fields for each row.

Comments

cezaryrk’s picture

StatusFileSize
new47.46 KB
new42.67 KB

hmm strange, I can't reproduce the error. I see were the error is thrown, but the value should be delivered be the 'field_group' module and must be set. Which version of 'field_group' and drupal are you using?

I tried simulate your configuration and it works fine, I attached my configuration screenshots.

cezaryrk’s picture

Assigned: Unassigned » cezaryrk
Priority: Major » Critical
adam_b’s picture

StatusFileSize
new5.69 KB
new22.25 KB
new16.75 KB

I'm using Drupal v7.12 and FGM 7.x-1.0-alpha4. Full module list attached.

Your screenshots look the same as mine - see attachments.

Not sure where that leaves us... :(

cezaryrk’s picture

Okay, I maybe found the problem.

I installed field_permissions module and when the grouped fields have permissions settings to private or public then the error isn't shown, but when I change to 'custom settings' then I've got it and the field isn't displayed.

I also get an exception in the field configuration when I try to change the field permissions back to private or public.

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7501 of /home/cezaryrk/Projekte/drupal/system/7.x/includes/common.inc).

I found the issue http://drupal.org/node/1321050

Have you maybe set the field permissions of a grouped field to 'custom settings'? And can you change it back to private or public?

adam_b’s picture

Sorry, that doesn't seem to be it - the permissions are "public" and always have been. I've just tried changing them to "private" but it made no difference, and I didn't get the exception that you've given above.

cezaryrk’s picture

I analysed this code and the only possibility that the notice is thrown, is that the field was removed by field_group_pre_render (which calls the function field_group_multiple_field_group_pre_render and pass through the three vars: $element, $group, $form).

A field is removed by field_group, if it is declared as not accessible, which means that some kind of module sets the field 'field_recommendation_type' as not accessible. The strange thing is that, the notice comes only for one field and not for all three fields and that the other fields aren't displayed.

If you change to an other group type like "Div" or "Fieldset" is the field_recommendation_type shown?

Currently I don't know if it is a problem in this module or of an other (your module list is very long ;), so there can be many possibilities ).

I corrected the code in alpha5, so the notice message shouldn't appear any more, but I doesn't solve your problem that the three fields aren't displayed. To solve this I need more information about the content of the three variables, which are passed to the function.

adam_b’s picture

If you change to an other group type like "Div" or "Fieldset" is the field_recommendation_type shown?

How or where would I find the field_recommendation_type?
ETA: sorry, just realized you meant the error message.

I'll do some more testing this weekend (maybe on an installation without quite so many test modules...) and get back to you.

cezaryrk’s picture

:) okay, thanks

adam_b’s picture

Version: 7.x-1.0-alpha4 » 7.x-1.0-alpha6
StatusFileSize
new750 bytes
new8.09 KB
new20.33 KB

Okay, I created a new Drupal installation with only Field group multiple (alpha-6) and the required modules (Field group, and Chaos tools). I made a multiple fields container, using all the default settings with three single text fields in it (see screenshot).

Result is that the content doesn't appear, and there's a broken clearfix tag displayed (see more screenshots). When I changed the display to "multiple fields talble", the broken clearfix tag disappeared, but the content still didn't display.

There are no warning messages, but there are notices:
Notice: Undefined index: field_text1 in template_preprocess_field_group_multiple_container() (line 628 of C:\Users\Adam.Browne\Sites\mfg\sites\all\modules\field_group_multiple\field_group_multiple.module).

Has anyone else tried this?

cezaryrk’s picture

The clearfix error is solved in alpha7, some php compiler don't understand '<?=' as php brackets I change this, sorry for that.

The other problem that the fields aren't displayed, is the same as before. You currently didn't got the warnings because I added some empty checks to prevent this ;).

To understand what is going wrong, I need some outputs of variables in the function 'field_group_multiple_field_group_pre_render' in the field_group_multiple.module file.

Can you put the three code lines

   drupal_set_message('<textarea>Element: ' . print_r($element,true) . '</textarea>','error');
   drupal_set_message('<textarea>Group: ' . print_r($group,true) . '</textarea>','error');
   drupal_set_message('<textarea>Form: ' . print_r($form,true) . '</textarea>','error');

in the file field_group_multiple.module at the Line 166 in alpha6 or alpha7, this code displays the three variables in textareas as drupal error message (after insert the three line, reload the page twice), can you attach the three outputs as txt files? After that remove the three lines.

Currently I didn't see an other option, because I can't reproduce this problem.

Example of adding the code:

  // code snippet from field_group_multiple.module starts at line 160 - 169
  else {
    // some display mode
    // form contains the entity
    $elements = array();
    $array_transposed = array();
    $field_not_in_elements = array();

    // Line: 167 ============ add this three line ============
    drupal_set_message('<textarea>Element: ' . print_r($element,true) . '</textarea>','error');
    drupal_set_message('<textarea>Group: ' . print_r($group,true) . '</textarea>','error');
    drupal_set_message('<textarea>Form: ' . print_r($form,true) . '</textarea>','error');
   // =============== end ===============    

    if (empty($group->children)) return; // do nothing if no fields are grouped

    foreach ($group->children as $field_name) {

adam_b’s picture

Version: 7.x-1.0-alpha6 » 7.x-1.0-alpha7
StatusFileSize
new152.71 KB
new1.17 KB
new26.41 KB

Okay, 3 lines added and errors duly appeared - output attached.

cezaryrk’s picture

Sorry, for the delayed answer.

I did run some tests and I tried the same field configuration like yours, but it works fine. Also I simulated the output with the 3 variables values, but with the same result. The fields are displayed.

I currently have no answer and I didn't know a reason why the fields aren't displayed, everything look like it should :(

@All: Have someone else the same behaviour?

cezaryrk’s picture

A new version 7.x-1.0-alpha10 is online, I rewrote a lot of code, maybe it works now.

adam_b’s picture

Version: 7.x-1.0-alpha7 » 7.x-1.0-alpha10

Sorry... still a problem.

The content displays if I have it set as div or fieldset, but the multiple-field options still just give the title but no display. There are no error messages any more, so no indication what's happening.

The source code for the multiple-field group setting is:
<div class="field-group-format group_mfg field-group-div group-mfg required-fields speed-fast effect-none"><h3><span>mfg</span></h3><div class="field-group-multiple-container clearfix"><div class="field-group-multiple-items"></div>

For the multiple-field table setting, there's a bit more info which looks suspicious:
<div class="field-group-format group_mfg field-group-div group-mfg required-fields speed-fast effect-none"><h3><span>mfg</span></h3><div class="field-group-multiple-table"><?= $table ?></div>

Sorry for the trouble. Unless someone else comes up with the same problem I guess there's not much more to do for the present.

cezaryrk’s picture

That no trouble for me, I want that the module works for all :)

But as long as I can't reproduce it, I can only speculate what going wrong :(, but currently I am at my wit's end.

Thanks you for your patience, if I got a new idea I post a message her.

cezaryrk’s picture

Version: 7.x-1.0-alpha10 » 7.x-1.0-alpha11

Okay I was a little bit premature in the release creation of alpha10, some major bugs had slipped in.

The container was not displayed and the table '<?= $table ?>' I changed to ' print $table; '

Sorry for that, maybe it works now with alpha11?

adam_b’s picture

Success!!! I'm glad to report that alpha11 works fine :)

cezaryrk’s picture

Status: Active » Fixed

That's great!!! :) Then enjoy this module :)

And thanks for the patience ;)

Status: Fixed » Closed (fixed)

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