Hi,
i am still trying to find out how i can validate fields of a DataObject in CMS.
My first steps are using the function validate()
class News extends DataObject {
...
public function getCMSFields() {
...
}
...
public function validate() {
$valid = parent::validate();
if ((!$this->Title) || ($this->Title=="")) {
$valid->error("Titel");
}
return $valid;
}
...
}
But with this I get the following:
[User Error] Uncaught ValidationException: Validation error writing a News object: Titel. Object not written.
POST ............/admin/EditForm/field/HomepageNews/AddForm
Line 715 in ........../sapphire/core/model/DataObject.php
So how do i have to catch the exception?
Thanks