Beispiel #1
0
 /**
  * Form fields values are valid
  *
  * @return boolean
  */
 public function isValid()
 {
     if (!$this->isSubmitted()) {
         return false;
     }
     $is_valid = true;
     foreach ($this->__fields as $k => &$f) {
         if (isset($f['rule'])) {
             foreach ($f['rule'] as $r => $v) {
                 if ($r === self::VALIDATE_MATCH) {
                     $validate = Validate::getInstance();
                     // valid match value
                     if (!$validate->match($this->getData($k), $this->getData($v['param'][0]))) {
                         $is_valid = false;
                         $f['error'][$r] = $v['message'];
                     }
                 } else {
                     self::__validate($r, $this->hasData($k) ? $this->__data[$k] : null, $f, $v, $is_valid);
                 }
             }
         }
     }
     return $is_valid;
 }
Beispiel #2
0
 /**
  * Validate helper
  *
  * @return \Eco\Factory\Validate
  */
 public static final function validate()
 {
     return Validate::getInstance();
 }