oh , thats the catch.. thanks steven<br clear="all">--<br>Regards,<br>Nitin Kumar Gupta<br><a href="http://publicmind.in/blog/">http://publicmind.in/blog/</a><br>
<br><br><div class="gmail_quote">On Wed, Oct 7, 2009 at 2:36 AM, Steven Jones <span dir="ltr"><<a href="mailto:steven.jones@computerminds.co.uk">steven.jones@computerminds.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
When the browser posts the form back to the web server it only sends<br>
the value of the form elements against their respective names. That<br>
is, the following input<br>
<br>
<input type="sometype" value="value" id="some-id" name="some-name" /><br>
<br>
would be posted back to the server as<br>
some-name = value.<br>
<br>
Since buttons are also posted back in the same way there is not way<br>
for Drupal know which button was pressed if they share the same name<br>
and value.<br>
<br>
Regards<br>
Steven Jones<br>
ComputerMinds ltd - Perfect Drupal Websites<br>
<br>
Phone : 024 7666 7277<br>
Mobile : 07702 131 576<br>
Twitter : darthsteven<br>
<a href="http://www.computerminds.co.uk" target="_blank">http://www.computerminds.co.uk</a><br>
<br>
<br>
<br>
2009/10/6 nitin gupta <<a href="mailto:nitingupta.iitg@gmail.com">nitingupta.iitg@gmail.com</a>>:<br>
<div><div></div><div class="h5">> Hello,<br>
> I am having two form submit buttons on a single page, somethings like this:<br>
> $form['submit1'] = array(<br>
> '#type' => 'submit',<br>
> '#value' => t('save'),<br>
> '#submit' => array('test_submit1'),<br>
><br>
> );<br>
><br>
> [some more for elements in between]<br>
> $form['submit2'] = array(<br>
> '#type' => 'submit',<br>
> '#value' => t('Save'),<br>
> '#submit' => array('test_submit2'),<br>
><br>
> );<br>
><br>
> Now, whether I click on any of them, the submit callback of second button is<br>
> called always. But if I change the value of second button or give them<br>
> different '#name', everything gets back in place. They call their submit<br>
> functions respectively.<br>
> I did not expect such a behavior given this:<br>
> <a href="http://drupal.org/node/144132#buttons" target="_blank">http://drupal.org/node/144132#buttons</a><br>
> Although, they both have same #value but will have different ids in the<br>
> form, so Drupal has every reason to differentiate between them (or not??).<br>
> Why is such thing happening? Am I missing something?<br>
> --<br>
> Regards,<br>
> Nitin Kumar Gupta<br>
> <a href="http://publicmind.in/blog/" target="_blank">http://publicmind.in/blog/</a><br>
><br>
</div></div></blockquote></div><br>