So, I'm looking at this section from multiform_get_form():

    // Retrieve buttons.
    if ($button_elements = form_get_cache($_POST['form_build_id'], $form_state_save)) {
      foreach ($button_elements as $button) {
        // For each button, save it's name. Later on we will need the button
        // names because the buttons are used in the multiform but their values
        // in $_POST (if it exists) needs to be handed down to each form so
        // those can recognize the button press.
        $name = isset($button_elements['#name']) ? $button_elements['#name'] : 'op';
        $button_names[$name] = $name;
      }
    }

That doesn't seem to work - for each $button in $button_elements... get the #name from $button_elements? If you want the name from $button_elements, why is there even a foreach here? It seems to make more sense if this is looking at $button['#name'] instead.

This probably seems to work because most buttons are 'op' on a form.

Comments

jcfiala’s picture

Status: Active » Needs review
StatusFileSize
new686 bytes

And to back that up, here's a patch for review.

joseph.olstad’s picture

Issue summary: View changes
StatusFileSize
new686 bytes

wake up testbot (I just fixed the simple test so expecting this to pass)

joseph.olstad’s picture

StatusFileSize
new755 bytes
joseph.olstad’s picture

StatusFileSize
new778 bytes

$name was out of scope on patch 4

  • joseph.olstad committed 1820ec0 on 7.x-1.x
    Issue #1539792 by joseph.olstad, jcfiala: Multiple buttons on form don't...
joseph.olstad’s picture

Status: Needs review » Fixed
joseph.olstad’s picture

this is in 7.x-1.x dev

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

joseph.olstad’s picture

this change was finally released in 7.x-1.4
Thanks jcfiala !