@@ -340,6 +340,9 @@ and uploading files::
340
340
// even fake a file upload
341
341
$form['registration[photo]']->upload('/path/to/lucas.jpg');
342
342
343
+ Using the Form Data
344
+ ...................
345
+
343
346
What's the point of doing all of this? If you're testing internally, you
344
347
can grab the information off of your form as if it had just been submitted
345
348
by using the PHP values::
@@ -375,5 +378,26 @@ directly::
375
378
// submit that form
376
379
$crawler = $client->submit($form);
377
380
381
+ .. _components-dom-crawler-invalid :
382
+
383
+ Selecting Invalid Choice Values
384
+ ...............................
385
+
386
+ .. versionadded :: 2.4
387
+ The :method: `Symfony\\ Component\\ DomCrawler\\ Form::disableValidation `
388
+ method was added in Symfony 2.4.
389
+
390
+ By default, choice fields (select, radio) have internal validation activated
391
+ to prevent you from setting invalid values. If you want to be able to set
392
+ invalid values, you can use the ``disableValidation() `` method on either
393
+ the whole form or specific field(s)::
394
+
395
+ // Disable validation for a specific field
396
+ $form['country']->disableValidation()->select('Invalid value');
397
+
398
+ // Disable validation for the whole form
399
+ $form->disableValidation();
400
+ $form['country']->select('Invalid value');
401
+
378
402
.. _`Goutte` : https://github.com/fabpot/goutte
379
403
.. _Packagist : https://packagist.org/packages/symfony/dom-crawler
0 commit comments