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();
}
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.