Problem/Motivation
When a form has multiple submit buttons, each one with a different callback sometimes the wrong callback actions is called
Steps to reproduce
Create a custom form with multiple callbacks and when it submits ignore the callback value and submit always to the first one, callback_a
<?php
$form['submit_calback_a']['1'] = array(
'#type' => 'submit',
'#submit' => array(
'calback_a',
),
'#value' => 'lorem',
'#attributes' => array(
'class' => array('btn-link'),
'title' => t('calback_a'),
),
'#name' => 'submit-callback_a',
);
$form['submit_calback_b']['1'] = array(
'#type' => 'submit',
'#submit' => array(
'calback_b',
),
'#value' => 'lorem',
'#attributes' => array(
'class' => array('btn-link'),
'title' => t('calback_b'),
),
'#name' => 'submit-callback_b',
);
$form['submit_calback_c']['1'] = array(
'#type' => 'submit',
'#submit' => array(
'calback_c',
),
'#value' => 'lorem',
'#attributes' => array(
'class' => array('btn-link'),
'title' => t('calback_c'),
),
'#name' => 'submit-callback_c',
);
?>Issue fork drupal-3376628
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jlopes23 commentedComment #4
vaibhav340 commentedSorry Wrong comment.. Unable to delete it
Comment #5
poker10 commentedThanks for reporting this @jlopes23.
I have tested this manually on clean Drupal 7.98 install with a simple form (code you provided) and it seems like the correct submit handlers are called. Can you please test this with a simple custom form containing only the code you provided, if it is still a problem?