By maozet on
Is there any way to replace the submit handler of a form?
function my_module_form_alter(&$form, &$form_state, $form_id) {
....
....
unset($form['#submit']);
unset($form['#validate']);
$form['#submit'][] = 'mymodule_submit_handler';
$form['#validate'][] = 'mymodule_validate_handler';
}
My validate function is executed allright
BUT: the original form submit handler is execute also (which is not what i am expecting)
Any idea?
Comments
try resetting the
try resetting the $form['#submit'] array. Your adding a new submit handler rather than overriding the current ones.
$form['#submit'] = array('mymodule_submit_handler');