Skip to content

Commit fce7657

Browse files
uikolasweaverryan
authored andcommitted
Edited to show more ways, to get crawler form
1 parent 8013d78 commit fce7657

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

components/dom_crawler.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,19 @@ given text. This method is especially useful because you can use it to return
338338
a :class:`Symfony\\Component\\DomCrawler\\Form` object that represents the
339339
form that the button lives in::
340340

341-
$form = $crawler->selectButton('validate')->form();
341+
// button example: <button id="my-super-button" type="submit">My super button</button>
342+
343+
// you can get button my it's name
344+
$form = $crawler->selectButton('My awesome button!')->form();
345+
346+
// or by by button id (#my-super-button) if button don't have name
347+
$form = $crawler->selectButton('my-super-button')->form();
348+
349+
// or you can filter whole form
350+
$crawler->filter('.form-vertical')->form();
342351

343352
// or "fill" the form fields with data
344-
$form = $crawler->selectButton('validate')->form(array(
353+
$form = $crawler->selectButton('my-super-button')->form(array(
345354
'name' => 'Ryan',
346355
));
347356

0 commit comments

Comments
 (0)