Contao\Widget::validate PHP Method

validate() public method

Validate the user input and set the value
public validate ( )
    public function validate()
    {
        $varValue = $this->validator($this->getPost($this->strName));
        if ($this->hasErrors()) {
            $this->class = 'error';
        }
        $this->varValue = $varValue;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Check for a valid option (see #4383)
  */
 public function validate()
 {
     $varValue = $this->getPost($this->strName);
     if (!empty($varValue) && !$this->isValidOption($varValue)) {
         $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalid'], is_array($varValue) ? implode(', ', $varValue) : $varValue));
     }
     parent::validate();
 }
All Usage Examples Of Contao\Widget::validate