symfony/symfony — pull request #6528 by bschussek (2012-12-31 17:16:35+00:00)
Title: [Form][WIP] Support buttons in forms

This is a WIP PR for #5383. It is not yet feature complete nor tested, but only a proof of concept. In particular this means that I won't comment on micro-optimization suggestions.

The general idea is to be able to add buttons to forms like so:

```php
$builder->add('clickme', 'submit');
```

You can then check in the controller whether the button was clicked:

```php
if ($form->get('clickme')->isClicked()) {
// do stuff
}
```

In the long run, I also want to support button-specific validation groups, but this is not implemented yet.

```php
$builder->add('clickme', 'submit', array(
'validation_groups' => 'OnlyClickMe',
));
```

Let me hear what you think!