8000 [Form] clear unchecked choice radio boxes even if clear missing is set to false by xabbuh · Pull Request #40417 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] clear unchecked choice radio boxes even if clear missing is set to false #40417

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

Merged
merged 1 commit into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
clear unchecked choice radio boxes even if clear missing is set to false
  • Loading branch information
xabbuh committed Mar 8, 2021
commit e7b4851ea04dfed6820a72a8c06b3899f2819b1b
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$knownValues[$child->getName()] = $value;
unset($unknownValues[$value]);
continue;
} else {
$knownValues[$child->getName()] = null;
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,20 @@ public function testSubmitSingleExpandedObjectChoices()
$this->assertNull($form[4]->getViewData());
}

public function testSubmitSingleExpandedClearMissingFalse()
{
$form = $this->factory->create(self::TESTED_TYPE, 'foo', [
'choices' => [
'foo label' => 'foo',
'bar label' => 'bar',
],
'expanded' => true,
]);
$form->submit('bar', false);

$this->assertSame('bar', $form->getData());
}

public function testSubmitMultipleExpanded()
{
$form = $this->factory->create(static::TESTED_TYPE, null, [
Expand Down
0