Multiple submits form and Ajax: Select which submit button is triggered As I can't find a way to split a Drupal Commerce pane into several forms (so far it creates several field-sets) I had to create several submit buttons in the same form. But it's the same submit button that always gets triggered.

I have these 2 "forms":

- Field 1.1
- Field 1.2
-&gt; Submit 1

- Field 2.1
-&gt;Submit 2


I believe this would not be a problem if I would not use ajax to submit the forms, but I do by using 'event' =&gt; 'click' so that the form is submited when ENTER is pressed.

My problem is that if I press ENTER from the field 2.1 it's the Submit 1 that gets triggered.

Any idea on how to select the right submit button with the click event?
My solution was to remove the Drupal click event:

'event' =&gt; 'click',


And to manually add it via jQuery by finding the next input button:

$('input.form-text', context).once('field_validation_keydown').keydown(function(event) {
  if (event.which == 13) {
    $(this).parent().nextAll('input.ajax-processed').trigger('mousedown');
  }
});


But if anyone has a better solution, I'm curious to know about it.