public function validate($args) { $valueToTest = $args[$this->getDisplayFieldName()]; if (!OJUtil::checkNotBlank($valueToTest) || preg_match('/^\\+?-?\\d+\\.+\\d*$/', $valueToTest)) { return true; } $this->error = array('message' => t('Field "%s" is not a vaild Decimal number.', $this->label), 'name' => $this->fieldName); return false; }
public function validate($args) { $valueToTest = $args[$this->getDisplayFieldName()]; if (!OJUtil::checkNotBlank($valueToTest) || $this->isInteger($valueToTest)) { return true; } $this->error = array('message' => t('Field "%s" is not an integer.', $this->label), 'name' => $this->fieldName); return false; }
public function validate($args) { $valueToTest = $args[$this->getDisplayFieldName()]; if (!OJUtil::checkNotBlank($valueToTest) || preg_match('/^\\$?.?.?.?[1-9]\\d*(?:\\.?\\d{0,2})?$/', $valueToTest)) { return true; } $this->error = array('message' => t('Field "%s" is not a vaild currency.', $this->label), 'name' => $this->fieldName); return false; }
public function validate($args) { $valueToTest = $args[$this->getDisplayFieldName()]; if (!OJUtil::checkNotBlank($valueToTest) || preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9\\._-])+.([a-zA-Z0-9\\._-]+)+$/', $valueToTest)) { return true; } $this->error = array('message' => t('Field "%s" is not a vaild email address.', $this->label), 'name' => $this->fieldName); return false; }
public function validate($args) { // var_dump($args); if (OJUtil::checkNotBlank($args[$this->getDisplayFieldName()])) { return true; } $this->error = array('message' => t('Field "%s" is required.', $this->label), 'name' => $this->fieldName); return false; }
public function setVars(&$hash) { if (OJUtil::checkNotBlank($hash['name'])) { $this->fieldName = $hash['name']; } else { throw new Exception("Field name cannot be blank", 1); } $this->label = $hash['name']; foreach ($hash as $key => $val) { $this->{$key} = $val; } }