Functions such as:function fund_node_form_submit($form_id, $form_values) are not called if the 'fund' node edit form contains an addnode widget.

It is because adding the $form['#submit']['node_form_submit'] = array(); and similar items to the $form stops the form_id_submit hook being called.

This is either because:

  • There's something horribly wrong with AddNode.
  • The subform-elements are overwriting a form_id or nodetype variable before it gets a chance to be called - so the wrong hook is called (could be tested).
  • There's a bug in the node api.

Comments

Lionfish’s picture

Status: Active » Fixed

The fix I've used treats the symptoms rather than fixes the underlying cause, so this is still a problem.

I've added the following code to the addnode_widget function, just before $form is returned:

        $function_name=$node->type."_node_form_submit";
        if (function_exists($function_name))
        {
          $form['#submit'][$function_name] = array();
        }

This calls any function with that name to get it submitted also.
There are probably similar problems with the subform's hooks not being called, so this issue isn't really finished with...

Maybe I'm misunderstanding how this API works... I'm basing all this on http://api.drupal.org/api/5/file/developer/topics/forms_api.html in the "Validating Forms" and "Submitting Forms" sections.

Anonymous’s picture

Status: Fixed » Closed (fixed)