I get the following error at admin/content/node-type/[my-type]/webform-fields

Invalid argument supplied for foreach() in .......\sites\all\modules\contrib\webform\includes\webform.components.inc on line 52.

Attempting to add a field, brings me to a 404 page.

using webform 6.x-3.11

It is a webform-enabled content type.

Comments

Angerslave’s picture

Status: Active » Closed (cannot reproduce)

Can't reproduce this. Please, provide more info. Is there other modules? Didn't any code fixes in this or webform module? May be something other unusual?

Thanks.

narhir’s picture

Priority: Normal » Critical
Status: Closed (cannot reproduce) » Active

Just wanted to let you know that I have exact same problem with this, to explain the problem in more details.

1. I enabled webform
2. I enabled Webform Default fields
3. I tried to create some "webform" content
4. Then I went to "webform settings" I enabled "webform" on my custom content type called "job applications"
5. I noticed on default fields page for "job applications" error on line 52 (but still I tried to add new component)
6. After trying to add new component it redirected me to "Cant fint his page 404" and give one more error beside 52:

warning: Invalid argument supplied for foreach() in /var/www/narhir/sites/all/modules/webform/includes/webform.components.inc on line 302.

any ideas how to solve this ? - thank you in advance

Angerslave’s picture

Have you tried to flush caches after enabling webform for custom content type?

narhir’s picture

Yes, I tried but it didnt helped.

Im on irc also, my nick is Narhir if you have any other quick questions,
Thank you for trying to help us out.

One more thing that I noticed after trying to "add default fields" it creates somekind of empty node whichout title or.. basically anything, and to delete this node you have to add title to it.. only then it is possible.

Im attaching screenshot that explain it:
http://i56.tinypic.com/15himah.png

cyborg_572’s picture

It's supposed to do that. The module attaches the default fields to that node, and then does whatever it can to hide it. When you make a new node, it clones the fields from that "master node"

If you delete that node, then I'm guessing you won't be able to add or create default fields.

Although... the node's not supposed to show up at admin/content/node...

Angerslave’s picture

Status: Active » Closed (fixed)

Solved by private messages.

vthirteen’s picture

Status: Closed (fixed) » Fixed

could you please share the solution? thanks!

Angerslave’s picture

Actually, Narhir created new content type and repeated same step for it, and all worked. I think it's related with described before "master node" system, which is pretty fragile, so simply deleting it may brake this functionality. I'll think about this cases when I'll have enough time and implement it in the module. For now I can recommend to flush cache after enabling webform for content type, which will lead to appropriate master node creation and not to delete master node, which actually should be hidden from nodes list.

damienmckenna’s picture

FYI the node will show on admin/content because the module doesn't do anything to stop it showing.

loze’s picture

For me this was due to my webform enabled content type having an underscore in it.
adding
$content_type = str_replace('-', '_', $content_type);
after line 99 fixed this for me.

8bitplateau’s picture

i had a problem with this module in that after a while it lost its default fields and when i tried to create new ones it 404'd, in fact what had happened is that I didn't know how the module worked [it wasn't obvious] and I found a piece of rouge content in my content list with no title name! and deleted it, so when I went back to the module admin page it get lost. When i realised this I reinstalled the module, created the default fields [which creates a master node], found it in the content list with no title and renamed it Master Webform so I didn't delete it again. thought that might be of help to some one.

cyborg_572’s picture

Status: Fixed » Needs review
StatusFileSize
new1.42 KB

So I've come up against this issue, and of course it's in the middle of crunch time. It seems to happen (in my case anyway) when the NID of the master node is known, but the node doesn't actually exist.

I've come up with a quick-and-dirty patch that checks if the node actually exists while loading the default fields configuration page, and makes a new one if it doesn't. I find I need to go to that page, and then refresh before the error goes away.

I think ideally there would be an option on the webform settings page to repair any missing container nodes, but this is working for me right now.

EDIT: I figured out what caused this for me. I used Devel's "Generate Content" with the "Delete all content" option enabled. Bye-bye master node.

Angerslave’s picture

Status: Needs review » Fixed

All code patches added to 1.3 version. Thank you.

Status: Fixed » Closed (fixed)

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