If you can see it, it is not mean that your submit hook not run,
you can use dpm
( it is useful dpm function in devel module ) or use something like below line in your submit or validate functions,
drupal_set_message("<pre>" . print_r($form, 1) . "</pre>");
function THEME_form_submit(&$form_state, $form_id){
if($form_id == "comment_node_memory_form" || $form_id == "comment_node_image_form"){
drupal_set_message("<pre>" . print_r($form_state, 1) . "</pre>");
}
}
after it you sure that your function run and you can see exists variable there.
first try this, if not work try other solution(creating module )
instead THEME_form_submit(&$form_state, $form_id){
write THEME_form_submit($form, &$form_state){
update part
I suggest you put this code in your custom module
function mycmodule_form_submit(&$form,&$form_state, $form_id){
if(in_array($form_id,array("comment_node_memory_form","comment_node_image_form"))){
$form['actions']['submit']['#submit'][] = '_mycmodule_custom_sumbmit_handler';
//ym($form);
}
}
function _mycmodule_custom_sumbmit_handler($form,&$form_state){
/// every sumibted data provided in $form_state
/// dsm($form_state);
drupal_set_message("<pre>" . print_r($form_state, 1) . "</pre>");
}
and if you not have custom module lead you to create it,
first creaate a directory(folder) name it as mycmodule
then create two file in it
mycumodule.module
mycumodule.info
then put this content in there
in mycumodule.module
function mycmodule_form_submit(&$form,&$form_state, $form_id){
if(in_array($form_id,array("comment_node_memory_form","comment_node_image_form"))){
$form['actions']['submit']['#submit'][] = '_mycmodule_custom_sumbmit_handler';
//ym($form);
}
}
function _mycmodule_custom_sumbmit_handler($form,&$form_state){
/// every sumibted data provided in $form_state
/// dsm($form_state);
drupal_set_message("<pre>" . print_r($form_state, 1) . "</pre>");
}
inmycmodule.info
name = My custom module
description = custom module provide some devel changes
core = 7.x
package = My Package
kpr($form_state);
working outside of the codition?Try this once, is this code gives you some output? If yes, then there's something wrong with your form_id.function THEME_form_submit($form,&$form_state, $form_id){ kpr($form_state); //Insert new node }
– Sugandh Khanna Jul 29 '15 at 7:24kpr
is not working because after submission it refreshes the page. – M a m a D Jul 29 '15 at 7:26