コード例 #1
0
 function validate()
 {
     if ($this->filter_html) {
         $this->_value = $this->_validator->filterHtml($this->_value);
     }
     return parent::validate();
 }
コード例 #2
0
ファイル: text_class.php プロジェクト: aselvan/PHPKnock
 /**
  * This function will validate the element's value against defined validation rules (e.g. not null, ...)
  *
  * The validation will also activate the error flag, if any
  * rule is broken, which will trigger the error message in
  * form mode output.
  *
  * @see		setMaximumLength()
  * @see		FormElement::validate()
  * @return	boolean		TRUE if no errors occurred
  */
 public function validate()
 {
     parent::validate();
     $value = trim($this->value());
     // only use reg exp validation if value is not empty.
     // an empty value validation should be made with setNotNull()
     if (!$this->isEmpty() && $this->validRegExp() != '' && !preg_match($this->validRegExp(), $value)) {
         $this->setError('REGEXP MISMATCH');
     }
     $this->_isValidated = true;
     return !$this->error();
 }