Skip to content

Commit f710996

Browse files
committed
minor #11705 [DomCrawler] Add hint about Form::getName method (JustBlackBird)
This PR was merged into the 4.4 branch. Discussion ---------- [DomCrawler] Add hint about Form::getName method This PR describes some use cases of `Symfony\Component\DomCrawler\Form::getName` method Commits ------- c8a6ec5 [DomCrawler] Add hint about Form::getName method
2 parents c746a77 + c8a6ec5 commit f710996

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
@@ -521,6 +521,8 @@ useful methods for working with forms::
521521

522522
$method = $form->getMethod();
523523

524+
$name = $form->getName();
525+
524526
The :method:`Symfony\\Component\\DomCrawler\\Form::getUri` method does more
525527
than just return the ``action`` attribute of the form. If the form method
526528
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
@@ -812,6 +812,12 @@ their type::
812812
$form['my_form[field][O]']->upload('/path/to/lucas.jpg');
813813
$form['my_form[field][1]']->upload('/path/to/lisa.jpg');
814814

815+
.. tip::
816+
817+
All field names in forms generated by Symfony are prefixed with the form's name.
818+
If the name is autogenerated you can get it using
819+
:method:`Symfony\\Component\\DomCrawler\\Form::getName` method.
820+
815821
.. tip::
816822

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

0 commit comments

Comments
 (0)