BUGFIX Fixed Text::scaffoldFormField() showing a "Is Null" checkbox, even if nullifyEmpty is true

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90747 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-11-03 22:27:56 +00:00
parent 8216448da3
commit adf9bc89fe
2 changed files with 6 additions and 4 deletions

View File

@ -309,10 +309,11 @@ class Text extends StringField {
* @see DBField::scaffoldFormField()
*/
public function scaffoldFormField($title = null, $params = null) {
if($this->nullifyEmpty) {
// We can have an empty field so we need to let the user specifically set null value in the field.
if(!$this->nullifyEmpty) {
// Allow the user to select if it's null instead of automatically assuming empty string is
return new NullableField(new TextareaField($this->name, $title));
} else {
// Automatically determine null (empty string)
return new TextareaField($this->name, $title);
}
}

View File

@ -81,9 +81,10 @@ class Varchar extends StringField {
*/
public function scaffoldFormField($title = null, $params = null) {
if(!$this->nullifyEmpty) {
// We can have an empty field so we need to let the user specifically set null value in the field.
// Allow the user to select if it's null instead of automatically assuming empty string is
return new NullableField(new TextField($this->name, $title));
} else {
// Automatically determine null (empty string)
return parent::scaffoldFormField($title);
}
}