소스 검색

merged branch hlecorche/valid-form-w3c (PR #2676)

Commits
-------

78e9b2f [Form] Fixed textarea_widget (W3C standards)

Discussion
----------

[Form] Fixed textarea_widget (W3C standards)

Textarea widget included the "pattern" attribute but is not valid by W3C standards.

(See PR 2666 - New PR because rebase inside the 2.0 branch)

---------------------------------------------------------------------------

by fabpot at 2011/11/18 09:01:41 -0800

@hlecorche: Thanks for your work on this issue. Can you update the unit tests to be sure that this case is covered? If you're not comfortable with this, just tell me and I will do it myself

---------------------------------------------------------------------------

by hlecorche at 2011/11/19 02:51:06 -0800

@fabpot: I did'nt commited because I am not sure. I changed the "tests/Symfony/Tests/Component/Form/AbstractLayoutTest.php" file :

    public function testTextarea()
    {
        $form = $this->factory->createNamed('textarea', 'na&me', 'foo&bar', array(
            'property_path' => 'name',
            'pattern' => 'foo',
        ));

        $this->assertWidgetMatchesXpath($form->createView(), array(),
    '/textarea
    [@name="na&me"]
    [not(@pattern)]
    [.="foo&bar"]
    '
        );
    }

Is it correct?
Fabien Potencier 13 년 전
부모
커밋
bb025bb904
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      src/Symfony/Component/Form/Extension/Core/Type/TextareaType.php

+ 10 - 0
src/Symfony/Component/Form/Extension/Core/Type/TextareaType.php

@@ -12,9 +12,19 @@
 namespace Symfony\Component\Form\Extension\Core\Type;
 
 use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\FormView;
+use Symfony\Component\Form\FormInterface;
 
 class TextareaType extends AbstractType
 {
+    /**
+     * {@inheritdoc}
+     */
+    public function buildView(FormView $view, FormInterface $form)
+    {
+        $view->set('pattern', null);
+    }
+
     /**
      * {@inheritdoc}
      */