I try to make fields required in the CMS:
class Documents extends DataObject {
private static $db = array(
'DocType' => 'Text',
'DocTitle' => 'Text',
'DocNumber' => 'Text'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields = FieldList::create(TabSet::create('Root'));
$fields->addFieldsToTab('Root.Main', array(
DropdownField::create('DocType','Document Type'),
DropdownField::create('DocStatus','Document Status'),
TextField::create('DocNumber','Document Number'),
...
RequiredFields::create(array('DocType','DocTitle','DocNumber'));
));
return $fields;
}
But in my SilverStripe error log I get the following:
"Uncaught Exeption: the method 'getname' doesn't exist on RequiredFields or the method is not public".
How do I make fields required in the SilverStripe CMS?