8000 [Form] Fix submitting checkboxes and radios with PATCH method by HeahDude · Pull Request #17771 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Fix submitting checkboxes and radios with PATCH method #17771

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
HeahDude committed Dec 3, 2016
commit 7472ba8842c23d41c7e679ec4c5b795fbe8acd3a
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CheckboxType extends AbstractType
Expand Down Expand Up @@ -51,13 +52,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)
*/
public function configureOptions(OptionsResolver $resolver)
{
$forceSubmit = function (FormInterface $form, $viewData) {
$emptyData = function (FormInterface $form, $viewData) {
return $viewData;
};

$forceSubmit = function (Options $options) {
return $options['data'];
};

$resolver->setDefaults(array(
'value' => '1',
'compound' => false,
'empty_data' => $emptyData,
'force_submit' => $forceSubmit, // internal
));
}
Expand Down
0