Skip to content

Commit

Permalink
bug #39099 [Form] ignore the pattern attribute for textareas (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.4 branch.

Discussion
----------

[Form] ignore the pattern attribute for textareas

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #39066
| License       | MIT
| Doc PR        |

Commits
-------

e7698e7 ignore the pattern attribute for textareas
  • Loading branch information
fabpot committed Nov 27, 2020
2 parents d558964 + e7698e7 commit 1fb80e7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2379,7 +2379,7 @@ public function testTextarea()
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
'/textarea
[@name="name"]
[@pattern="foo"]
[not(@pattern)]
[@class="my&class form-control"]
[.="foo&bar"]
'
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"symfony/dependency-injection": "^3.4|^4.0|^5.0",
"symfony/error-handler": "^4.4|^5.0",
"symfony/finder": "^3.4|^4.0|^5.0",
"symfony/form": "^4.3.5",
"symfony/form": "^4.4.17",
"symfony/http-foundation": "^4.3|^5.0",
"symfony/http-kernel": "^4.4",
"symfony/mime": "^4.3|^5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TextareaType extends AbstractType
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['pattern'] = null;
unset($view->vars['attr']['pattern']);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2068,7 +2068,7 @@ public function testTextarea()
$this->assertWidgetMatchesXpath($form->createView(), [],
'/textarea
[@name="name"]
[@pattern="foo"]
[not(@pattern)]
[.="foo&bar"]
'
);
Expand Down

0 comments on commit 1fb80e7

Please sign in to comment.