From: uw
Date: Wed Jan 10 02:00:34 2001
Modified files:
php-lib/php/form/form.inc
Log message:
validate() bug fix.
Index: php-lib/php/form/form.inc
diff -u php-lib/php/form/form.inc:1.20 php-lib/php/form/form.inc:1.21
--- php-lib/php/form/form.inc:1.20 Mon Jan 8 02:05:27 2001
+++ php-lib/php/form/form.inc Wed Jan 10 02:00:32 2001
@@ -26,7 +26,7 @@
* - tree (select box with options show as a tree)
*
* @author Ulf Wendel <[EMAIL PROTECTED]>
-* @version $Id: form.inc,v 1.20 2001/01/08 01:05:27 uw Exp $
+* @version $Id: form.inc,v 1.21 2001/01/10 01:00:32 uw Exp $
* @access public
* @package Form
*/
@@ -670,19 +670,26 @@
* Validate a form.
*
* @param mixed $vallist
+ * @throws form_error
* @return array($error_msg, $error_flags)
* @access public
*/
function validate($vallist = "") {
+
+ if ($vallist && !is_array($vallist))
+ $vallist = array($vallist);
+ if (!$vallist)
+ $vallist = $this->getElementnames();
+
+ foreach ($vallist as $k => $element)
+ if (!$this->elementExists($element)) {
+ $this->err = new form_error("Unknown element
+'$element'", __FILE__, __LINE__);
+ return array("", "");
+ }
+
$this->validation_msg = "";
$this->validation_flags = array();
-
- if (!is_array($vallist) && isset($this->elements[$vallist]))
- $vallist = array($vallist);
-
- if ("" == $vallist)
- $vallist = $this->getElementnames();
foreach ($this->getCustomValidators($vallist) as $k => $validator)
$this->${validator}();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]