In Drupal 7 form API - How do I create an input of type "button" (not "submit")?

Doron picture Doron · Jan 3, 2011 · Viewed 28.1k times · Source

I am trying to have a button which is not a "submit" type of button, but rather a normal "button" type, using the forms api of drupal 7, but I can't seem to get it.

I've tried many things, like setting #type to 'button', setting #button_type to 'button' but no matter what I do, drupal always creates a button of type "submit".

Answer

J. Costa picture J. Costa · Apr 26, 2011

You can use:

"#executes_submit_callback" => FALSE

To disable the "submit" step.

If you only want to disable the "validate" step, use:

"#limit_validation_errors" => array()