Skip to content

Commit 13a5281

Browse files
committed
minor #12121 Add in the DOM crawler documentation code sample to show how to tick checkboxes (LucileDT)
This PR was merged into the 3.4 branch. Discussion ---------- Add in the DOM crawler documentation code sample to show how to tick checkboxes <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- ab4715e Add in the DOW crawler documentation code sample to show how to tick checkboxes
2 parents 5151707 + ab4715e commit 13a5281

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

components/dom_crawler.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ To work with multi-dimensional fields::
482482
<input name="multi[]"/>
483483
<input name="multi[]"/>
484484
<input name="multi[dimensional]"/>
485+
<input name="multi[dimensional][]" value="1"/>
486+
<input name="multi[dimensional][]" value="2"/>
487+
<input name="multi[dimensional][]" value="3"/>
485488
</form>
486489

487490
Pass an array of values::
@@ -495,6 +498,11 @@ Pass an array of values::
495498
'dimensional' => 'an other value',
496499
]]);
497500

501+
// tick multiple checkboxes at once
502+
$form->setValues(['multi' => [
503+
'dimensional' => [1, 3] // it uses the input value to determine which checkbox to tick
504+
]]);
505+
498506
This is great, but it gets better! The ``Form`` object allows you to interact
499507
with your form like a browser, selecting radio values, ticking checkboxes,
500508
and uploading files::

0 commit comments

Comments
 (0)