/** * Run validation on the server side * * Method will run the validation on the server side (will not run the JS function type) and return * the result * * @access public * @param string &$errmsg The error message if the validation fails * @return bool TRUE if the validation was successful, FALSE if it failed */ public function runValidation(&$errmsg) { if (!parent::runValidation($errmsg)) { return false; } $value = $this->getValue(); if ($value == '') { return true; } $value = explode('-', $value); $value = mktime(1, 1, 1, (int) $value[1], (int) $value[2], (int) $value[0]); if ($this->extraInfo['limitfrom'] !== '') { $limitfrom = explode('-', $this->extraInfo['limitfrom']); $limitfrom = mktime(1, 1, 1, (int) $limitfrom[1], (int) $limitfrom[2], (int) $limitfrom[0]); if ($value < $limitfrom) { $errmsg = sprintf(GetLang('CustomFieldsValidationNumbersToLow'), $this->label, $this->extraInfo['limitfrom']); return false; } } if ($this->extraInfo['limitto'] !== '') { $limitto = explode('-', $this->extraInfo['limitto']); $limitto = mktime(1, 1, 1, (int) $limitto[1], (int) $limitto[2], (int) $limitto[0]); if ($value > $limitto) { $errmsg = sprintf(GetLang('CustomFieldsValidationNumbersToHigh'), $this->label, $this->extraInfo['limitto']); return false; } } return true; }
/** * Run validation on the server side * * Method will run the validation on the server side (will not run the JS function type) and return * the result * * @access public * @param string &$errmsg The error message if the validation fails * @return bool TRUE if the validation was successful, FALSE if it failed */ public function runValidation(&$errmsg) { if (!parent::runValidation($errmsg)) { return false; } $value = $this->getValue(); if ($value == '') { return true; } if (!is_numeric($value)) { $errmsg = sprintf(GetLang('CustomFieldsValidationNumbersOnly'), $this->label); return false; } if ($this->extraInfo['limitfrom'] !== '' && (int)$value < (int)$this->extraInfo['limitfrom']) { $errmsg = sprintf(GetLang('CustomFieldsValidationNumbersToLow'), $this->label, $this->extraInfo['limitfrom']); return false; } if ($this->extraInfo['limitto'] !== '' && (int)$value > (int)$this->extraInfo['limitto']) { $errmsg = sprintf(GetLang('CustomFieldsValidationNumbersToHigh'), $this->label, $this->extraInfo['limitto']); return false; } return true; }
/** * Run validation on the server side * * Method will run the validation on the server side (will not run the JS function type) and return * the result * * @access public * @param string &$errmsg The error message if the validation fails * @return bool TRUE if the validation was successful, FALSE if it failed */ public function runValidation(&$errmsg) { if (!parent::runValidation($errmsg)) { return false; } $values = $this->getValue(); if ($values == '') { return true; } /** * Just need to check that all our selected values actually existing within our options array */ if (empty($this->extraInfo['options'])) { return true; } foreach ($values as $value) { if (!Store_Array::inArrayCI($value, $this->extraInfo['options'])) { $errmsg = sprintf(GetLang('CustomFieldsValidationInvalidSelectOption'), $this->label); return false; } } return true; }
/** * Run validation on the server side * * Method will run the validation on the server side (will not run the JS function type) and return * the result * * @access public * @param string &$errmsg The error message if the validation fails * @return bool TRUE if the validation was successful, FALSE if it failed */ public function runValidation(&$errmsg) { /** * If this was a textbox when it was submitted then turn of the required flag */ $isText = $this->getFieldRequestValue('IsText'); if ($isText !== '' && (int) $isText == 1) { $this->setRequired(false); } return parent::runValidation($errmsg); }
/** * Run validation on the server side * * Method will run the validation on the server side (will not run the JS function type) and return * the result * * @access public * @param string &$errmsg The error message if the validation fails * @return bool TRUE if the validation was successful, FALSE if it failed */ public function runValidation(&$errmsg) { /** * Because this can be left unchanged without passing a value to it (frontend only), * then we cannot really set this as required if we originally have a value for it */ if (!defined('ISC_ADMIN_CP') && parent::getFieldRequestValue('AlreadySet') == '1') { $this->setRequired(false); } if (!parent::runValidation($errmsg)) { return false; } return true; }