mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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:
parent
382235ffbf
commit
3c7168c58c
2 changed files with 11 additions and 0 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue