function isValid(&$var, &$vars, $value, &$message) { $valid = true; $length = Horde_String::length(trim($value)); if ($var->isRequired() && $length <= 0) { $valid = false; $message = Horde_Form_Translation::t("This field is required."); } elseif ($length > $this->_chars) { $valid = false; $message = sprintf(Horde_Form_Translation::ngettext("There are too many characters in this field. You have entered %d character; ", "There are too many characters in this field. You have entered %d characters; ", $length), $length) . sprintf(Horde_Form_Translation::t("you must enter less than %d."), $this->_chars); } return $valid; }