-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added documentation for buttons in forms #2489
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
Conversation
webmozart
commented
Apr 11, 2013
Q | A |
---|---|
Doc fix? | no |
New docs? | yes (symfony/symfony#6528) |
Applies to | 2.3 |
Fixed tickets | - |
->getForm(); | ||
|
||
In your controller, use the button's | ||
:method:`Symfony\\Component\\Form\\ClickableInterface\\isClicked` method for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo ClickableInterface::isClicked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Fixed and pushed. |
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
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 7c47e34928c39e4797edc841423237a16588395e) 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
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 7c47e34928c39e4797edc841423237a16588395e) 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
@weaverryan the code is merged, so this is ready for merging! |
Very nice job Bernhard - easy merge! |
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 7c47e34928c39e4797edc841423237a16588395e) 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
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 7c47e34928c39e4797edc841423237a16588395e) 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
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 7c47e34928c39e4797edc841423237a16588395e) 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