Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Checkboxes array issue #60

dbykadorov opened this Issue · 9 comments

4 participants

Dmitry Michael Dowling Christophe Coevoet 8w

Imagine we have a complex form which contains following part:

<input name="foo[]" id="foo-10" value="10" type="checkbox">
<input name="foo[]" id="foo-11" value="11" type="checkbox">

<input name="bar[]" id="bar-11" value="11" type="checkbox">
<input name="bar[]" id="bar-12" value="12" type="checkbox">

This part submitted as array:


And on server side

// $_POST['foo']
array(0 => '10', 1 => '11')

But when I create form with Goutte i have one 'foo[]' checkbox with possible value 11 and one 'bar[]' checkbox with possible value 12.

So I can't check both foo[] checkboxes or first one (same for bar[]).

Is this any workarround or this is a bug? I'm not sure in component which produces this behavior (Goutte/Guzzle/Crawler), sorry )

Michael Dowling

I'm unclear on what the exact issue is.

Is it sending the POST correctly over the wire?


Yes, it sends. But the form created from crawler think that there are only one checkbox named 'foo[]' and one checkbox named 'bar[]'. So I can't check both foo[]/bar[] checkboxes or check only first checkboxes. If I try to post like this:

$this->crawler = $this->client->submit($form, array(
    'foo[]' => 10,

The client says that foo[] can accept only value '11'

My response clarifies the problem?

Michael Dowling

Yes, thanks. If Guzzle is sending things over the wire correctly, then this looks like an issue with one of the Symfony components that Goutte uses.


Unfortunately I can't figure out which of Symfony components is responsible for this error. Probably the Browser, but I'm not sure. Any ideas? )

Christophe Coevoet

are you using the stable versions of the component or the 2.1-dev version ? This issue should be fixed in 2.1 by the refactoring of the DomCrawler internals


@stof sorry, I'm on 2.0.x now :((( I'm waiting for official release of 2.1

Christophe Coevoet

then it is a known issue for 2.0.x


@stof Thank you! Looks like we need to plan migration to 2.1 :)

8w commented

Gentlemen is this issue now closed? (The composer dependencies suggest you've moved to domcrawler 2.1?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.