[development] Form with multiple submit buttons

nitin gupta nitingupta.iitg at gmail.com
Tue Oct 6 19:57:49 UTC 2009

I am having two form submit buttons on a single page, somethings like this:

$form['submit1'] = array(
    '#type' => 'submit',
    '#value' => t('save'),
    '#submit' => array('test_submit1'),


[some more for elements in between]

  $form['submit2'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#submit' => array('test_submit2'),


Now, whether I click on any of them, the submit callback of second button is
called always. But if I change the value of second button or give them
different '#name', everything gets back in place. They call their submit
functions respectively.

I did not expect such a behavior given this:


Although, they both have same #value but will have different ids in the
form, so Drupal has every reason to differentiate between them (or not??).
Why is such thing happening? Am I missing something?

Nitin Kumar Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20091007/8dd54784/attachment.html 

More information about the development mailing list