-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Support buttons in forms #5383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
ref #5231 |
fabpot
added a commit
that referenced
this issue
Apr 17, 2013
This PR was merged into the master branch. Discussion ---------- [2.3] [Form] Support buttons in forms Bug fix: no Feature addition: yes Backwards compatibility break: yes Symfony2 tests pass: yes Fixes the following tickets: #5383 Todo: - License of the code: MIT Documentation PR: symfony/symfony-docs#2489 The general idea of this PR 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 } ``` Button-specific validation groups are also supported: ```php $builder->add('clickme', 'submit', array( 'validation_groups' => 'OnlyClickMe', )); ``` The validation group will then override the one defined in the form if that button is clicked. This PR also introduces the disabling of form validation by passing the value `false` in the option `validation_groups`: ```php $builder->add('clickme', 'submit', array( 'validation_groups' => false, )); ``` The same can be achieved (already before this PR) by passing an empty array: ```php $builder->add('clickme', 'submit', array( 'validation_groups' => array(), )); ``` See the linked documentation for more information. Commits ------- faf8d7a [Form] Added upgrade information about setting "validation_groups" => false d504732 [Form] Added leading backslashes to @exceptionMessage doc blocks c8afa88 [Form] Removed deprecated code scheduled for removal in 2.3 36ca056 [Form] Simplified Twig code ce29c70 [Form] Fixed incorrect doc comment 0bc7129 [Form] Fixed invalid use of FormException 600007b [Form] The option "validation_groups" can now be set to false to disable validation. This is identical to setting it to an empty array. 277d6df [Form] Fixed concatenation operator CS (see 7c47e34) 7b07925 [Form] Changed isset() to array_key_exists() to be consistent with ParameterBag 7b438a8 [Form] Made submit buttons able to convey validation groups cc2118d [Form] Implemented support for buttons
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In my latest meeting with the Drupal people, we talked about their native support for buttons in forms which is currently missing in Symfony. They support things like:
This ticket needs more research, but we should look into supporting these use cases in future releases.
The text was updated successfully, but these errors were encountered: