diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index 7f5e323975478..c1a4aa00f1ee6 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -67,7 +67,7 @@ {% block choice_widget_collapsed %} {% spaceless %} - {% if required and empty_value is none and not empty_value_in_choices %} + {% if required and empty_value is none and not empty_value_in_choices and not multiple %} {% set required = false %} {% endif %} block($form, 'widget_attributes', array( - 'required' => $required && (null !== $empty_value || $empty_value_in_choices) + 'required' => $required )) ?> multiple="multiple" > diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index 28827e51b75c8..7aee4694e33d5 100644 --- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -636,6 +636,7 @@ public function testMultipleChoice() { $form = $this->factory->createNamed('name', 'choice', array('&a'), array( 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), + 'required' => true, 'multiple' => true, 'expanded' => false, )); @@ -643,6 +644,7 @@ public function testMultipleChoice() $this->assertWidgetMatchesXpath($form->createView(), array(), '/select [@name="name[]"] + [@required="required"] [@multiple="multiple"] [ ./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy