diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index aae6cc7b5..fd61cf957 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -84,16 +84,23 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm ->setFilters(array('StringTrim')) ->setValidators(array( 'NotEmpty', - 'EmailAddress', - new Zend_Validate_Callback(function ($value, $context) { - if ($context['enableSystemEmail']) { - return true; - } - - return false; - }) - )) - ->setDecorators(array('ViewHelper')); + 'EmailAddress' + )) + ->setDecorators(array('ViewHelper')); + + $systemEmail->addValidator('Callback', true, array( + 'callback' => function($value, $context) { + if ($context['enableSystemEmail']) { + return true; + } + return false; + }, + 'messages' => array( + Zend_Validate_Callback::INVALID_VALUE => 'Email must be enabled' + ), + )); + + $this->addElement($systemEmail); }