Ejemplo n.º 1
0
 private function _validateFieldHandler($name, Form_Field $handler, $label)
 {
     if (is_array($name)) {
         $val = array();
         foreach ($name as $n) {
             $val[] = isset($this->_input[$n]) ? $this->_input[$n] : '';
         }
     } else {
         $val = isset($this->_input[$name]) ? $this->_input[$name] : '';
     }
     $handler->validate($val, $label, $this->_input);
     if ($handler->error()) {
         $this->_errors[] = array('field' => $name, 'label' => $label, 'error' => 'Invalid', 'message' => $handler->error());
         return false;
     } else {
         if (is_array($name)) {
             $i = 0;
             $sanitized = $handler->sanitized();
             foreach ($name as $n) {
                 $this->_input[$n] = $sanitized[$i];
                 $i++;
             }
         } else {
             $this->_input[$name] = $handler->sanitized();
         }
         return true;
     }
 }