BUGFIX: removed name attribute from label fields since this is invalid html. Ticket: #4887. PATCH via tobych (from r97013)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102418 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 03:31:02 +00:00
parent 227bfffc0b
commit 2179389da3
2 changed files with 14 additions and 2 deletions

View File

@ -37,8 +37,7 @@ class LabelField extends DatalessField {
function Field() {
$attributes = array(
'class' => $this->extraClass(),
'id' => $this->id(),
'name' => $this->Name(),
'id' => $this->id()
);
return $this->createTag(
'label',

View File

@ -0,0 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage tests
*/
class LabelFieldTest extends SapphireTest {
function testFieldHasNoNameAttribute() {
$field = new LabelField('MyName', 'MyTitle');
$this->assertEquals($field->Field(), '<label id="MyName">MyTitle</label>');
}
}