By pan69 on
Hi.
I was working on implementing a form the other day and I ran into an issue where I had to catch a form submit event. After looking here and there and asking around I was pointed out to use the hook_form_submit for this, however, when I implement it it's not triggered and I also can find it on api.drupal.org.
This page http://api.drupal.org/api/file/developer/topics/forms_api.html seems to be discussing the hook but for me this doesn't seem to work when I implement it.
Is there something I'm doing wrong?
Thanks,
Luke
PS: It's also not listed on the regular cheat sheets (http://drupal.org/node/212648).
Comments
If I understand you question,
If I understand you question, you want "something to happen" after the submit button is hit?
Have you looking into the hook_form_validate()?
http://api.drupal.org/api/function/node_type_form_validate
I recall a similar issue and was able to use this function to modify what happens after on validation.
However, with me it was for incorrect data. Are you instead looking to redirect someone after they hit submit?
hi, In Drupal 6 they have
hi,
In Drupal 6 they have made some changes in the Form API, they changed the submit handlers
here is it, explained clearly about the differences http://drupal.org/node/144132 kindly go through.
there is always hook_form_submit and additional feature is you can have separate submit function for each button
here in above example we call separate function for delete button in #submit attribute.
in the same way you can also have custom function for the form submit
in the above example through form alter we are assigning the custom submit function to the form
all reference are from http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...
--
Kamalakannan S
Kiluvai Tech Solutions Private Limited br Blog
Ah. There you go. If you're
Ah. There you go. If you're not aware of this change it's quite difficult to figure out.
Not sure why the change, it's still as cryptic as ever... :)
maybe you need hook_nodeapi?
function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'submit':
break;
case 'insert':
break;
}