=================================================================== RCS file: /horde/cvs/framework/Form/Form.php,v retrieving revision 1.322 retrieving revision 1.323 diff -p --unified=3 -r1.322 -r1.323 --- Form.php 2005/04/26 15:46:37 1.322 +++ Form.php 2005/05/01 19:32:11 1.323 @@ -5,7 +5,7 @@ * The Horde_Form:: package provides form rendering, validation, and * other functionality for the Horde Application Framework. * - * $Horde: framework/Form/Form.php,v 1.321 2005/04/20 08:29:17 jan Exp $ + * $Horde: framework/Form/Form.php,v 1.322 2005/04/26 15:46:37 jan Exp $ * * Copyright 2001-2005 Robert E. Coyle * Copyright 2001-2005 Chuck Hagenbuch @@ -852,6 +852,11 @@ class Horde_Form_Type_weatherdotcom exte function isValid(&$var, &$vars, $value, &$message) { + if (!is_null($this->_maxlength) && String::length($value) > $this->_maxlength) { + $message = sprintf(_("Value is over the maximum length of %s."), $this->_maxlength); + return false; + } + require_once 'Services/Weather.php'; $weatherDotCom = &Services_Weather::service('WeatherDotCom'); $weatherDotCom->setAccountData('', ''); @@ -1167,7 +1172,10 @@ class Horde_Form_Type_text extends Horde { $valid = true; - if ($var->isRequired() && empty($this->_regex)) { + if (!is_null($this->_maxlength) && String::length($value) > $this->_maxlength) { + $valid = false; + $message = sprintf(_("Value is over the maximum length of %s."), $this->_maxlength); + } elseif ($var->isRequired() && empty($this->_regex)) { $valid = strlen(trim($value)) > 0; if (!$valid) {