BUGFIX Make sure that CheckboxField sets it's value as either 1 or 0, so that saveInto() saves the proper boolean value

MINOR Added tests for observing the dataValue() and Value() return values based on setting different values to the field


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@75046 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-04-23 12:12:51 +00:00 committed by Sam Minnee
parent 578a53a9cc
commit 8605743ea6
3 changed files with 10 additions and 3 deletions

View File

@ -16,6 +16,10 @@ class CheckboxField extends FormField {
return ($this->value) ? 1 : 0;
}
function Value() {
return ($this->value) ? 1 : 0;
}
function Field() {
$attributes = array(
'type' => 'checkbox',

View File

@ -113,14 +113,14 @@ class FormField extends RequestHandler {
/**
* Returns the field message, used by form validation
*/
function Message(){
function Message() {
return $this->message;
}
/**
* Returns the field message type, used by form validation
*/
function MessageType(){
function MessageType() {
return $this->messageType;
}

View File

@ -1,5 +1,8 @@
<?php
/**
* @package sapphire
* @subpackage tests
*/
class CheckboxSetFieldTest extends SapphireTest {
static $fixture_file = 'sapphire/tests/forms/CheckboxSetFieldTest.yml';