/** * Checks to see if the current value for this is set and valid. * @return boolean */ public function isValid() { if ($this->issetValue()) { return I2CE_Validate::checkNumber($this->getValue()); } return false; }
/** * Validate this form. */ public function validate() { if (I2CE_Validate::checkNumber($this->count, 1)) { if (!$this->code_start || !I2CE_Validate::checkNumber($this->code_start, 0)) { $this->setInvalidMessage('code_start', 'required'); } if ($this->code_format != "") { if (preg_match('/%[\\d\\.]*d/', $this->code_format) == 0) { $this->code_format .= "%d"; } $storage = I2CE_ModuleFactory::instance()->getClass("forms-storage"); if ($storage instanceof I2CE_FormStorage) { $count = $this->count; $code_start = $this->code_start; while ($count--) { $this->code = sprintf($this->code_format, $code_start); $storage->validate_formfield($this->getField("code")); if ($this->getField("code")->hasInvalid()) { $this->setInvalidMessage("code_format", 'unique'); } $code_start++; } } } } parent::validate(); }
/** * Checks to see if the current value for this is set and valid. * @return boolean */ public function isValid() { $ret = true; if (is_array($this->getValue())) { foreach ($this->getValue() as $val) { $ret = $ret && I2CE_Validate::checkNumber($val); } } else { $ret = false; } return $ret; }