-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Bug] [Form] 2.7 - Form collection prototype required option #15544
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
I think this is because there is some special logic for the @webmozart do you have an idea to fix it ? |
@stof in which case can "translation_domain" inheritance of prototype become an issue ? |
Inheritance of options for the prototype is not preserved, every option except 'label' is set to default by a call to // Symfony/Component/Form/Extension/Core/Type/CollectionType.php
public function buildForm(FormBuilderInterface $builder, array $options)
{
if ($options['allow_add'] && $options['prototype']) {
$prototype = $builder->create($options['prototype_name'], $options['type'], array_replace(array(
'label' => $options['prototype_name'].'label__',
), $options['options']));
$builder->setAttribute('prototype', $prototype->getForm());
}
... |
…ed" is false, "prototype" should too (HeahDude) This PR was squashed before being merged into the 2.3 branch (closes #16959). Discussion ---------- [Form] fix #15544 when a collection type attribute "required" is false, "prototype" should too | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #15544 | License | MIT | Doc PR | - Commits ------- b4b5d63 [Form] fix #15544 when a collection type attribute "required" is false, "prototype" should too
* 2.3: [Form] fix #15544 when a collection type attribute "required" is false, "prototype" should too updated validators.bg.xlf [Security] Enable bcrypt validation and result length tests on all PHP versions [Security] Verify if a password encoded with bcrypt is no longer than 72 characters [Console] Avoid extra blank lines when rendering exceptions [Yaml] do not remove "comments" in scalar blocks
* 2.7: [SecurityBundle] Removing test insulations for a huge perf win [Validator] Use the new interface in the README [Filesystem] fix tests on 2.3 [Filesystem] Recursivly widen non-executable directories [Form] fix #15544 when a collection type attribute "required" is false, "prototype" should too updated validators.bg.xlf [Security] Enable bcrypt validation and result length tests on all PHP versions [Security] Verify if a password encoded with bcrypt is no longer than 72 characters [Console] Avoid extra blank lines when rendering exceptions [Console][Table] fixed render row with multiple cells. [Yaml] do not remove "comments" in scalar blocks Conflicts: src/Symfony/Component/Console/Application.php src/Symfony/Component/Console/Tests/Fixtures/application_renderexception1.txt src/Symfony/Component/Console/Tests/Fixtures/application_renderexception2.txt src/Symfony/Component/Console/Tests/Fixtures/application_renderexception4.txt src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php src/Symfony/Component/Yaml/Tests/ParserTest.php
* 2.8: Fix merge [SecurityBundle] Removing test insulations for a huge perf win [Validator] Use the new interface in the README [Validator] Add missing pt_BR translation Fix doctrine bridge tests on older PHP versions [Filesystem] fix tests on 2.3 [Filesystem] Recursivly widen non-executable directories [DependencyInjection] fixed definition loosing property shared when decorated by a parent definition [Form] fix #15544 when a collection type attribute "required" is false, "prototype" should too updated validators.bg.xlf [Security] Enable bcrypt validation and result length tests on all PHP versions [Security] Verify if a password encoded with bcrypt is no longer than 72 characters [Console] Avoid extra blank lines when rendering exceptions [Console][Table] fixed render row with multiple cells. [Yaml] do not remove "comments" in scalar blocks Conflicts: src/Symfony/Component/Console/Tests/Fixtures/application_renderexception2.txt src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php
* 3.0: Fix merge [SecurityBundle] Removing test insulations for a huge perf win [Validator] Use the new interface in the README [Validator] Add missing pt_BR translation Fix doctrine bridge tests on older PHP versions [Filesystem] fix tests on 2.3 [Filesystem] Recursivly widen non-executable directories [DependencyInjection] fixed definition loosing property shared when decorated by a parent definition [Form] fix #15544 when a collection type attribute "required" is false, "prototype" should too updated validators.bg.xlf [Security] Enable bcrypt validation and result length tests on all PHP versions [Security] Verify if a password encoded with bcrypt is no longer than 72 characters [Console] Avoid extra blank lines when rendering exceptions [Console][Table] fixed render row with multiple cells. [Yaml] do not remove "comments" in scalar blocks
When using the 'collection' form type with the 'required' option set to false, The rendered HTML is different between the form_widget() macro and the prototype. The macro does not output the required field contrary to the prototype field.
Form definition :
Twig Template :
HTML output :
data-prototype:
Is that, the expected result ? I would expect the prototype field not to contain 'required' as the form_widget() macro doesn't output the 'required' field
I know the 'option' parameter is supposed to do the job but as the 'required' parameter is supported, the prototype output should match the macro output.
The text was updated successfully, but these errors were encountered: