diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index c6163f0fbcb..6d2745066b2 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -478,6 +478,8 @@ useful methods for working with forms:: $method = $form->getMethod(); + $name = $form->getName(); + The :method:`Symfony\\Component\\DomCrawler\\Form::getUri` method does more than just return the ``action`` attribute of the form. If the form method is GET, then it mimics the browser's behavior and returns the ``action`` diff --git a/testing.rst b/testing.rst index 3163d57721a..2b86ef7bd5e 100644 --- a/testing.rst +++ b/testing.rst @@ -801,6 +801,12 @@ their type:: $form['my_form[field][O]']->upload('/path/to/lucas.jpg'); $form['my_form[field][1]']->upload('/path/to/lisa.jpg'); +.. tip:: + + All field names in forms generated by Symfony are prefixed with the form's name. + If the name is autogenerated you can get it using + :method:`Symfony\\Component\\DomCrawler\\Form::getName` method. + .. tip:: If you purposefully want to select "invalid" select/radio values, see