简体   繁体   中英

form submit hook handler not getting called in drupal

I have Drupal 7 site. It has custom module named say myproducts . This module has following hook

function myproducts_form_alter(&$form, &$form_state, $form_id) {

if(isset($form_id) && $form_id=='product_node_form')
{
   $form['#submit'][] = 'myform_form_submit';
}

}


function myform_form_submit(){
 echo 'test submit handler'; exit();
 }

But `myform_form_submit` is not getting called.

Any help highly appreciated.

I don't see any errors. Make sure you clear your cache using Drush( drush cc all ) or through Drupal's UI . After that I would echo $form_id to make see what's the actual value of it is. I would also recommend using the devel module . It's great for debugging!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM