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.
Hello,
I want use tablefield module for my site. But, i get an error when i create a table in the node page admin :
"warning: Invalid argument supplied for foreach() in /var/www/vhosts/xxxxxxxxx/httpdocs/sites/all/modules/cck/modules/content_multigroup/content_multigroup.node_form.inc on line 397"
Do you have a solution?
Thanks.
Comment | File | Size | Author |
---|---|---|---|
#1 | cck-buttonsubmitfix-1281450-1.patch | 841 bytes | infiniteluke |
Comments
Comment #1
infiniteluke CreditAttribution: infiniteluke commentedI was seeing this error when a "button" form element on a form containing a multigroup was pressed. In my case "Rebuild Table" from the tablefield module was rebuilding the form and refreshing the page to change a table size. This obviously also causes validation as well.
When a form is submitted to be saved $form_state['submitted'] is set to true and _content_multigroup_node_form_after_build runs a few functions to clean up the $form_state array. The same after build function runs in the example above, but because the $form_state['submitted'] is false in that case, the validation function gets passed a malformed $form_state array.
Changing..
if ($form_state['submitted'] && !$form_state['multigroup_add_more']) {
to
if (($form_state['submitted'] || $form_state['clicked_button']) && !$form_state['multigroup_add_more']) {
in _content_multigroup_node_form_after_build should cover this case.
Cross-referencing a similar issue: #730154: Multigroup fields no longer saving; error in content_multigroup.node_form.inc on line 369.
Not sure if these are duplicates. It could be a separate issue.
To test this you can form alter a form with a multigroup on it and add a "button" form element. Click the button and see if this error occurs. Apply the patch and try clicking the button again. Or you could test with the tablefield module.
Comment #2
infiniteluke CreditAttribution: infiniteluke commentedBetter title