Skip to content

Commit 36ced8b

Browse files
committed
[DomCrawler] Add hint about Form::getName method
1 parent 27fc5dc commit 36ced8b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

components/dom_crawler.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@ useful methods for working with forms::
478478

479479
$method = $form->getMethod();
480480

481+
$name = $form->getName();
482+
481483
The :method:`Symfony\\Component\\DomCrawler\\Form::getUri` method does more
482484
than just return the ``action`` attribute of the form. If the form method
483485
is GET, then it mimics the browser's behavior and returns the ``action``

testing.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,12 @@ their type::
801801
$form['my_form[field][O]']->upload('/path/to/lucas.jpg');
802802
$form['my_form[field][1]']->upload('/path/to/lisa.jpg');
803803

804+
.. tip::
805+
806+
All field names in forms generated by symfony are prefixed with form's name.
807+
If the name is autogenerated you can get it using
808+
:method:`Symfony\\Component\\DomCrawler\\Form::getName` method.
809+
804810
.. tip::
805811

806812
If you purposefully want to select "invalid" select/radio values, see

0 commit comments

Comments
 (0)