Hi, I was experimenting with drupal_execute, but this set of functions does not seem to work the way I expect it to. I change the function the node creation form submits to and then try to call drupal_execute to pass the values. function splitter_form_alter($form_id, &$form) { if ($form_id == 'page_node_form') { $form['#submit'] = array( 'splitter_submit' => array() ); } } function splitter_submit($form_id, $form_values) { drupal_execute('page_node_form', $form_values); } However, this does not seem to work. After I submit, I get a blank page and no node is created. What am I missing? Thanks, Domas
I'm not sure if this is causing your problem, but it's what I'd try first. $form['#submit'] is unfortunately very fragile, in that if someone has set it before you, you must respect their setting. Something like: // Notify us when form is submitted. $submit_cb = array('splitter_submit' => array()); if (is_array($form['#submit'])) $form['#submit'] += $submit_cb; else $form['#submit'] = $submit_cb; That way you respect any submit callbacks that are already associated with the form. It's an easy thing for modules to miss. -Dave On Fri, 16 Nov 2007 09:21:18 +0200, "domas" <domas.m@gmail.com> said:
Hi, I was experimenting with drupal_execute, but this set of functions does not seem to work the way I expect it to. I change the function the node creation form submits to and then try to call drupal_execute to pass the values.
function splitter_form_alter($form_id, &$form) { if ($form_id == 'page_node_form') { $form['#submit'] = array( 'splitter_submit' => array() ); } }
function splitter_submit($form_id, $form_values) { drupal_execute('page_node_form', $form_values); }
However, this does not seem to work. After I submit, I get a blank page and no node is created.
What am I missing?
Thanks, Domas
I'm not sure if this is causing your problem, but it's what I'd try first.
yes, but I know, that my function is called when the form is submitted. And the $forn_values argument comes intact. I believe the problem is with the drupal_execute statement. Maybe I am calling it in an inappropriate way? Domas
These blog posts may help you with your troubleshooting: http://www.civicactions.com/blog/cck_import_and_update http://2bits.com/articles/creating-nodes-using-mini-forms-anywhere.html
I was experimenting with drupal_execute, but this set of functions does not seem to work the way I expect it to. I change the function the node creation form submits to and then try to call drupal_execute to pass the values.
function splitter_form_alter($form_id, &$form) { if ($form_id == 'page_node_form') { $form['#submit'] = array( 'splitter_submit' => array() ); } }
function splitter_submit($form_id, $form_values) { drupal_execute('page_node_form', $form_values); }
However, this does not seem to work. After I submit, I get a blank page and no node is created.
What am I missing?
participants (3)
-
Dale McGladdery -
David Cohen -
domas