By kkinfy on
Hi Everyone,
In my application I have two content types. When user submits one of the contents, I need to programmatically fill in details for the content of the other type and submit it. For this purpose I think I shoud be using drupal_execute() function.
But where exactly to use this function. I mean is there some function when implemented will get invoked after the submission of a form? I was referring to forms api documentation but with no success. Can someone help me in this regard?
Comments
Register a #submit callback in a hook_form_alter()
http://api.drupal.org/api/function/hook_form_alter/
E.g., to add a submit handler to the 'story_node_form' form:
Hi Thanks, but ..
Hi Thanks a lot, but my problem is bit tricky.
From your example, i can invoke
example_story_node_form_submitwhile submitting example_form_story_node_form. But I also have a requirement to pass on few field values from the invoking form to the invoked form. Please can you tell me ,if this this possible by some means?Submitted values are available
The form values submitted are available in the #submit callback in the $form_state['values'] argument.
To see how this works, you can study some of the functions in Drupal core whose names end in _submit.
http://api.drupal.org/api/search/6/_submit
e.g. a simple one: http://api.drupal.org/api/function/example_form_submit/6