mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
validate that a classname had been set
This commit is contained in:
parent
e80795b52d
commit
8703ace32a
@ -39,6 +39,18 @@ class Validator extends RequiredFields
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When the record is unsaved and the classname is not set throw an error
|
||||||
|
if ((!$this->record || !$this->record->exists()) && (!isset($data['ClassName']) || empty($data['ClassName']))) {
|
||||||
|
$this->validationError(
|
||||||
|
'ClassName',
|
||||||
|
_t(
|
||||||
|
__CLASS__ . 'CLASSNAME_ERROR',
|
||||||
|
'You need to select a field type before you can create the field'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Skip unsaved records
|
// Skip unsaved records
|
||||||
if (!$this->record || !$this->record->exists()) {
|
if (!$this->record || !$this->record->exists()) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user