Hi,

I set up my nodereference fields following the documentation. (I have set autocreate reference as unlimited in CCK options...)

When I go to create a node that have some autocreate references, when I click on the Ajax "Add element" button, and, when I click on it I get some errors :

    * warning: Invalid argument supplied for foreach() in\sites\all\modules\cck\includes\content.node_form.inc on line 320.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in \sites\all\modules\cck\includes\content.node_form.inc on line 346.
    * warning: Wrong parameter count for max() in \sites\all\modules\cck\includes\content.node_form.inc on line 346.

Any idea how to fix it ?

Comments

sunset_bill’s picture

Is this happening when you try to add an ANR field to your content type or when you try to post a content type that has an ANR field?

What Ajax module(s) are you using to add/edit content? I only get "Save" and "Preview" for submitting content and "Save Field Settings" for adding a field, no "Add Element" buttons. I'm also not sure what you mean by setting autocreate reference to unlimited in CCK options. It sounds like we're in slightly different environments.

Someone else has reported something like this: http://drupal.org/node/368904 though, as mentioned there, I've had no luck getting these errors to happen myself, and so can't tell what's going on.

sunset_bill’s picture

Status: Active » Postponed (maintainer needs more info)
Grayside’s picture

Rewriting this, because I failed at reading comprehension.

I also get this warning.

I created an Autocreate Node Reference field with "Number of Values" set to Unlimited in the field configuration page.

I hit save after finishing the configuration, and went to create my ANR Test page. A small CCK form element showed in the "node/add/anr_test" form. It appeared with a two-column label, "Field Label" and "Order", and an empty re-orderable table row beneath it. Below that, a button labeled "Add Another Item". When you press the button, it makes an AJAX call trying to add another row element to the UI. This is the behavior of Nodereference when set to unlimited, but broken and missing actual content for the "table row".

sunset_bill’s picture

Ah, I think I'm starting to see the source of our mutual confusion. What you're talking about has to do with Node Reference fields, and I'm afraid I have to refer you to the CCK folks for that.

Unlike Node Reference, which creates a reference to an existing node and allows the user to specify what node to reference, Autocreate Node Reference creates a reference to a node that doesn't exist yet at the time a user posts something, by cloning a node specified by the admin for the field in question. So, where Node Reference offers the user an input to choose what node they want to reference, the user creating or editing a node that has an ANR field never sees any kind of prompt or input area for the ANR field. (To see ANR from the user side, go to http://rageagainstthecubefarm2.com/node/add/anr-test. Be sure to hit Save.)

Hope that helps.

salud,
Bill

Grayside’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Active

I created an Autocreate Node Reference field. What this looks like is an artifact of Nodereference sneaking in when you select the Unlimited Option.

If the unlimited option isn't showing up in your version of the Autocreate Node Reference Field Configuration screen, ANR is probably incompatible with one of the core CCK modules, as I've got nothing else installed on my dev instance.

jgpippin’s picture

I also get this warning. I've reviewed my installation and procedures for ANR, and I'm 99.9% sure I'm doing it exactly correct. I get the same set of PHP errors when I try to add a new node. Any chance this issue will be addressed? It's a great module, and I'd love to use it.

sunset_bill’s picture

OK, I see what's going on now. The deal is that ANR is intended to create just one node reference per ANR field, so the Number of values in Global settings needs to be set to 1. I've added a warning about that to the documentation.

Methos76’s picture

I found this module right now an run into the mentioned error.
I think this module would be very useful ( at least for me) when it became possible to to create an unlimited number of node references per ANR field. what a pitty that it cant do that, so i have to look around for other modules, but i think none can what i'm looking for, cause this one was the one which was nearest to my needs....