I'm using the button type for a form, even explicitly setting #submit to FALSE, but it still submits. I'm curious, too, why this uses the submit type instead of button... but really, the bug is the issue. Ex:

$form['pane']['continue'] = array(
  '#type' => 'button',
  '#value' => 'Continue'
);

Straight from the Forms API, submits the form.

$form['pane']['continue'] = array(
  '#type' => 'button',
  '#submit' => 'FALSE',
  '#value' => 'Continue'
);

Still submits. Using a touch of JS is the only way I've been able to get it to not submit:

$form['pane']['continue'] = array(
  '#type' => 'button',
  '#value' => 'Continue',
  '#attributes' => array('onclick' => 'return false;')
);

I don't mind doing that, since I'm using some other JS on the button to expand the next fieldset for the user... but it seems like according to the documentation I shouldn't have to do this. Looking at the code just confuses me, so I have no clue on how to patch it.

Comments

chx’s picture

Status: Active » Closed (works as designed)