I updated Drupal core to 6.26 along with several other modules. Webform editing somehow got corrupted--the JS drop down editing would not drop down. To solve that problem, I reinstalled Java Script Update and Webform 3.18. This fixed the drop down issue, but introduced another problem. The drop down box now has a red box with the following 2 errors:

warning: Invalid argument supplied for foreach() in /web/virtual/georgewright.org/htdocs/sites/all/modules/webform/includes/webform.components.inc on line 504.
warning: Invalid argument supplied for foreach() in /web/virtual/georgewright.org/htdocs/sites/all/modules/webform/includes/webform.components.inc on line 504.

I read through the bug reports and followed the advice of several to reinstall Drupal Core and the same version of webform once more, but neither worked to fix the error.
I would be grateful for any thoughts or portential solutions for this problem.
Thanks.

Comments

quicksketch’s picture

If you're using Form Builder (looks like you are), I suggest upgrading to the latest dev version of both Webform and Form Builder until the next release of each module is released.

quicksketch’s picture

Project: Webform » Form Builder
Version: 6.x-3.18 » 7.x-1.0
Component: Code » Webform Itegration

Let's move this to Form Builder, since that's the more likely culprit.

smithangj’s picture

I updated to dev versions of both modules and the error still appears. I will keep an eye out for further notes. Thanks a bunch.

quicksketch’s picture

Perhaps this is related to #1553108: Invalid argument supplied for foreach() in form_builder_webform_form_builder_load() with unknown types? I still haven't been able to reproduce the problem, so if you can try out the new 1.1 version of the module (which includes that fix) and report back, I'd appreciate knowing if the problem has been solved.

oriol_e9g’s picture

With:

Webform 6.x-3.18
Form builder 6.x-1.1
Options element 6.x-1.7
jQuery UI 6.x-1.5

I get two errors #1720528: Missing argument 4 for form_builder_property_options_form() and #1598804: Invalid argument supplied for foreach() in _webform_components_tree_flatten()

When I apllied the the patch in http://drupal.org/node/1598804#comment-6035850 and in http://drupal.org/node/1720528#comment-6329504 I get this error now: xxx/drupal/sites/all/modules/webform/includes/webform.components.inc a la línia 504.

I think everything is related :/

oriol_e9g’s picture

StatusFileSize
new37.55 KB

I can reproduce this error in a fresh Drupal 6 installation:

Environment: Drupal 6.26 - Apache/2.2.22 (Win32) PHP/5.3.13

Steps:
1. Install a fresh Drupal 6.26
2. Install and enable:

  • Webform 6.x-3.18
  • jQuery Update 6.x-2.0-alpha1 (with jQuery 1.3.2)
  • jQuery UI 6.x-1.5 (with UI 1.7.3)
  • Options element 6.x-1.7
  • Form builder 6.x-1.2
  • Form builder Webform UI 6.x-1.2

3. Go to node/add/webform, add a random title and Save
4. Drag&Drop checkboxes field in the Form preview area
5. Click on a default selected checkbox
6. See the error:
webform error

Plus: If I update to webform 6.x-3.x-dev I get the same error four lines below:

warning: Invalid argument supplied for foreach() in D:\wamp\www\drupal6-wf\sites\all\modules\webform\includes\webform.components.inc on line 508.
warning: Invalid argument supplied for foreach() in D:\wamp\www\drupal6-wf\sites\all\modules\webform\includes\webform.components.inc on line 508.
quicksketch’s picture

Category: support » bug

Thanks @oriol_e9g. I'll give this a shot. Sounds like we have a high degree of certainty this is a bug.

oriol_e9g’s picture

Version: 7.x-1.0 » 6.x-1.x-dev
Status: Active » Needs work

I have tested the same with a fresh install of:

Drupal 7.15
Webform 7.x-3.18
Form builder 7.x-1.2
Form builder Webform UI 7.x-1.2
Options element 7.x-1.7

And It's working fine! So, this bug it's specific for the 6.x version.

jonathonfletcher’s picture

I too am experiencing this issue, to add to this, it is possible to insert new fields and label these etc. however, after saving the webform, these new fields are not visibile in the webform.

Is there any update on a resoltuion to this?

I have even tried installed the Dev version with no noted change to the issue.

asmaabd’s picture

i found out the solution :)

here is the steps:
1- go to the (....\modules\webform\includes) open the file (webform.components)
2- go to line 504
3- put the following code above it

if (is_array($values))
{
4-now you need to close the if..so, go to line 518 (or whatever the end of the foreach) and type under it
}

the final code should be like this (the one in bold is the new lines)
------------------------------
if (is_array($values))
{

foreach ($node->webform['components'] as $cid => $test_component) {
// Only components before the pagebreak can be considered.
if ($test_component['type'] == 'pagebreak') {
$last_pagebreak_slice = $counter;
}
if (isset($component['cid']) && $cid == $component['cid']) {
break;
}
if (webform_component_feature($test_component['type'], 'conditional')) {
$conditional_components[$cid] = $test_component;
$counter++;
}
}
}
--------------------------------
this forum was helpful for me to figured it out
http://stackoverflow.com/questions/2630013/invalid-argument-supplied-for...

best of luck to you all :)
Asma

quicksketch’s picture

I finally can reproduce this problem after updating Drupal core to 6.26. Odd that it was working perfectly fine in the previous version. My local was still back on 6.19, but I'm surprised that any core update would cause such a problem.

I'm looking into this now. Thanks everyone for the repeated updates.

quicksketch’s picture

Status: Needs work » Fixed
StatusFileSize
new606 bytes

This patch corrects the issue by making the $node object available for newly added form components.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Edited language for clarity.