How to call a multiple submit handler Please provide a code with description and example

Comments

jaypan’s picture

$form['#submit'] = array('submit_handler1', 'submit_handler2', ...);

Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
hemant_gautam’s picture

$form['submit_one'] = array(
  '#type' => 'submit',
  '#value' => t('Submit One'),
  '#submit' => array('my_module_form_submit_one'),
);
$form['submit_two'] = array(
  '#type' => 'submit',
  '#value' => t('Submit Two'),
  '#submit' => array('my_module_form_submit_two'),
);
deepak_mishra’s picture

Thank alot Hemant i will try with these code and let you know its working or not

murraybiscuit’s picture

Similar to @Jaypan's first comment, this worked for me:

$form['#submit'][] = 'my_module_custom_submit_handler';