Example #1
0
 public function validate()
 {
     parent::validate();
     if (!$this->blank) {
         $this->valid_format("email", '/^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-\\+]+)*@[a-zA-Z0-9-]+(\\.[a-zA-z0-9-]+)*(\\.[a-zA-Z]{2,4})$/i');
     }
 }
Example #2
0
 /**
  * Validates field's errors and returns them as array
  * @return array
  */
 public function validate()
 {
     if (is_null($this->sourceField)) {
         $this->_addError("required option auto_source was not set");
     } elseif (!$this->getModel()->hasField($this->sourceField)) {
         $this->_addError("auto_source field '{$this->sourceField}' does not exists");
     }
     return parent::validate();
 }