diff --git a/code/Company.php b/code/Company.php index 4a1e662..d03d2ba 100644 --- a/code/Company.php +++ b/code/Company.php @@ -47,7 +47,7 @@ class Company extends DataObject 'Name'=>'Varchar(255)', 'Category'=>'Varchar(255)', 'Revenue'=>'Float', - 'CEO'=>'Varchar(255)', + 'CEO'=>'Varchar(255)' ); private static $has_one = array( @@ -102,13 +102,13 @@ public function getCMSFields() public function validate() { - if (!$this->Title) { - $result = new ValidationResult(); - $result->addError('Title is required'); - return $result; - } else { - return parent::validate(); + $result = parent::validate(); + + if (!$this->Name) { + $result->addFieldError('Name', 'Name is required'); } + + return $result; } public function DynamicProperty()