Removing unwanted id from radio elements

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5539 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
dho 2007-08-17 08:50:16 +00:00
parent 382235ffbf
commit 3c7168c58c
2 changed files with 11 additions and 0 deletions

View file

@ -730,6 +730,10 @@ class FormHelper extends AppHelper {
unset($attributes['type']);
}
if (isset($attributes['id'])) {
unset($attributes['id']);
}
$value = isset($attributes['value']) ? $attributes['value'] : $this->value($fieldName);
$out = array();

View file

@ -448,6 +448,13 @@ class FormHelperTest extends CakeTestCase {
$this->assertNoPattern('/<input[^<>]+[^type|name|id|value|class]=[^<>]*>/', $result);
}
function testRadio() {
$result = $this->Form->radio('Model.field', array('option A', 'option B'));
$this->assertPattern('/id="field_0"/', $result);
$this->assertPattern('/id="field_1"/', $result);
$this->assertNoPattern('/id="ModelField"/', $result);
}
function testSelect() {
$result = $this->Form->select('Model.field', array());
$this->assertPattern('/^<select [^<>]+>\n<option [^<>]+>/', $result);