function validate()
 {
     // we must regenerate code if validation fails
     $result = parent::validate();
     if (!$result) {
         unset($_SESSION['S_IMAGE_DECODED']);
         $this->generateCode();
     }
     return $result;
 }
Beispiel #2
0
 function validate()
 {
     // empty value is allowed
     if ($this->value != '') {
         if (!is_numeric($this->value)) {
             $this->displayFieldError('Not a valid number');
         }
         if ($this->min !== null && $this->value < $this->min || $this->max !== null && $this->value > $this->max) {
             $this->displayFieldError('Number not in valid range');
         }
     }
     return parent::validate();
 }