Nette\Forms\Container::validate PHP Метод

validate() публичный Метод

Performs the server side validation.
public validate ( array $controls = NULL ) : void
$controls array
Результат void
    public function validate(array $controls = NULL)
    {
        foreach ($controls === NULL ? $this->getComponents() : $controls as $control) {
            if ($control instanceof IControl || $control instanceof self) {
                $control->validate();
            }
        }
        if ($this->onValidate !== NULL) {
            if (!is_array($this->onValidate) && !$this->onValidate instanceof \Traversable) {
                throw new Nette\UnexpectedValueException('Property Form::$onValidate must be array or Traversable, ' . gettype($this->onValidate) . ' given.');
            }
            foreach ($this->onValidate as $handler) {
                $params = Nette\Utils\Callback::toReflection($handler)->getParameters();
                $values = isset($params[1]) ? $this->getValues($params[1]->isArray()) : NULL;
                Nette\Utils\Callback::invoke($handler, $this, $values);
            }
        }
        $this->validated = TRUE;
    }

Usage Example

Пример #1
0
 public function validate(array $controls = NULL)
 {
     $this->cleanErrors();
     if ($controls === NULL && $this->submittedBy instanceof ISubmitterControl) {
         $controls = $this->submittedBy->getValidationScope();
     }
     $this->validateMaxPostSize();
     parent::validate($controls);
 }