diff --git a/forms/CheckboxSetField.php b/forms/CheckboxSetField.php
index 65e2718ae..7dcad4f8b 100755
--- a/forms/CheckboxSetField.php
+++ b/forms/CheckboxSetField.php
@@ -82,7 +82,7 @@ class CheckboxSetField extends OptionsetField {
$odd = ($odd + 1) % 2;
$extraClass = $odd ? "odd" : "even";
$extraClass .= " val" . str_replace(' ','',$key);
-
+
$itemID = $this->id() . "_" . ereg_replace('[^a-zA-Z0-9]+','',$key);
$checked ="";
@@ -95,8 +95,7 @@ class CheckboxSetField extends OptionsetField {
$options .= "
\n";
}
-
- return "id()}\" class=\"optionset\">\n$options
\n";
+ return "id()}\" class=\"optionset checkboxsetfield{$this->extraClass()}\">\n$options
\n";
}
function setDisabled($val) {
diff --git a/tests/forms/CheckboxSetFieldTest.php b/tests/forms/CheckboxSetFieldTest.php
index 1a95642f1..7370c643d 100644
--- a/tests/forms/CheckboxSetFieldTest.php
+++ b/tests/forms/CheckboxSetFieldTest.php
@@ -4,6 +4,14 @@ class CheckboxSetFieldTest extends SapphireTest {
static $fixture_file = 'sapphire/tests/forms/CheckboxSetFieldTest.yml';
+ function testAddExtraClass() {
+ /* CheckboxSetField has an extra class name and is in the HTML the field returns */
+ $cboxSetField = new CheckboxSetField('FeelingOk', 'Are you feeling ok?', array(0 => 'No', 1 => 'Yes'), '', null, '(Select one)');
+ $cboxSetField->addExtraClass('thisIsMyExtraClassForCheckboxSetField');
+ preg_match('/thisIsMyExtraClassForCheckboxSetField/', $cboxSetField->Field(), $matches);
+ $this->assertTrue($matches[0] == 'thisIsMyExtraClassForCheckboxSetField');
+ }
+
function testSaveWithNothingSelected() {
$article = $this->fixture->objFromFixture('CheckboxSetFieldTest_Article', 'articlewithouttags');