symfony/symfony — Issue #2720: [DomCrawler] Option fields disabled when the first element is disabled
Author: proofek
Created: 2011-11-25 14:25:35+00:00
State: open

At the moment DomCrawler marks an option field disabled (radio button) when the first radio button is disabled. This applies to set of options with the same name.

Example:

One

Two

Three

```php
createNode('input', '', array('type' => 'radio', 'name' => 'name', 'value' => 'foo', 'disabled' => 'disabled'));
$field = new ChoiceFormField($node);

$node = $this->createNode('input', '', array('type' => 'radio', 'name' => 'name', 'value' => 'bar'));
$field->addChoice($node);

$field->select('bar');
$field->isDisabled() // returns true
?>
```

At the moment there is no support for specific options to be disabled. I think it applies to checkboxes and select lists as well. You can disable single options, yet DomCrawler will detect the field disabled not the option.

What I'd expect:

```php
createNode('input', '', array('type' => 'radio', 'name' => 'name', 'value' => 'foo', 'disabled' => 'disabled'));
$field = new ChoiceFormField($node);

$node = $this->createNode('input', '', array('type' => 'radio', 'name' => 'name', 'value' => 'bar'));
$field->addChoice($node);

$field->select('foo');
$field->isDisabled() // returns true

$field->select('bar');
$field->isDisabled() // returns false
?>
```