diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 6ddd29daa16..616d0ada91f 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -396,10 +396,19 @@ given text. This method is especially useful because you can use it to return a :class:`Symfony\\Component\\DomCrawler\\Form` object that represents the form that the button lives in:: - $form = $crawler->selectButton('validate')->form(); + // button example: + + // you can get button by its label + $form = $crawler->selectButton('My super button')->form(); + + // or by button id (#my-super-button) if the button doesn't have a label + $form = $crawler->selectButton('my-super-button')->form(); + + // or you can filter the whole form, for example a form has a class attribute:
+ $crawler->filter('.form-vertical')->form(); // or "fill" the form fields with data - $form = $crawler->selectButton('validate')->form(array( + $form = $crawler->selectButton('my-super-button')->form(array( 'name' => 'Ryan', ));