So, there is this, uh, guy I know who can't seem to grok what is happening in the new D7 drupal_form_submit() function when he is submitting multiple nodes at a time (e.g. looping over a file of records for import). What appears to be happening is this: the first record is submitted and inserted within node_save() function. The nid from this record is retained/cached/whatever, so node_save() sees any subsequently submitted records as already having a nid and therefor treats them as updates to the first insert instead of as new new nodes. So, if I were to do something like: http://drupalbin.com/17729
The only new record I see is "foo-#1", foo-#1 having overwritten foo-#0.
So, I guess I'm wondering if is this expected behavior and I'm just not passing the node form everything it needs? Or possibly my install is somehow scrogged? Or?
BTW, I noticed that if I just hack node_form() to generate a fresh node object each submit with:
node_object_prepare($node); $form_state['node'] = $node;
The problem goes away. But, I don't really know why yet.
Thanks much! -Chad
P.S. I'm aware of and love the feeds module but still want to understand this problem :).
Chad Fennell wrote:
BTW, I noticed that if I just hack node_form() to generate a fresh node object each submit with:
node_object_prepare($node); $form_state['node'] = $node;
The problem goes away. But, I don't really know why yet.
File an issue at http://drupal.org/project/issues/drupal.
Ok, thanks Earnie, will do.
On Thu, Feb 17, 2011 at 7:06 AM, Earnie Boyd earnie@users.sourceforge.net wrote:
Chad Fennell wrote:
BTW, I noticed that if I just hack node_form() to generate a fresh node object each submit with:
node_object_prepare($node); $form_state['node'] = $node;
The problem goes away. But, I don't really know why yet.
File an issue at http://drupal.org/project/issues/drupal.
-- Earnie -- http://progw.com
-- http://www.for-my-kids.com
[ Drupal support list | http://lists.drupal.org/ ]