From da87f71a158905b4732aa21bc20c4833260a7dfb Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Mon, 21 Sep 2015 14:14:49 +1200 Subject: [PATCH] Fix for compatibility with userforms 3.0 --- code/EditableSpamProtectionField.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/code/EditableSpamProtectionField.php b/code/EditableSpamProtectionField.php index ec6caa9..965e01b 100644 --- a/code/EditableSpamProtectionField.php +++ b/code/EditableSpamProtectionField.php @@ -1,17 +1,17 @@ Parent()->Fields() instanceof UnsavedRelationList) { return $fields; } - + // Each other text field in this group can be assigned a field mapping $mapGroup = FieldGroup::create(_t( 'EditableSpamProtectionField.SPAMFIELDMAPPING', @@ -104,10 +104,17 @@ if(class_exists('EditableFormField')) { return $fields; } + public function validateField($data, $form) { + $formField = $this->getFormField(); + if (!$formField->validate($form->getValidator())) { + $form->addErrorMessage($this->Name, $this->getErrorMessage()->HTML(), 'error', false); + } + } + public function getFieldValidationOptions() { return new FieldList(); } - + public function getRequired() { return false; } @@ -115,7 +122,7 @@ if(class_exists('EditableFormField')) { public function getIcon() { return 'spamprotection/images/' . strtolower($this->class) . '.png'; } - + public function showInReports() { return false; }