From e348efb92de213fcfbc312993d8b21a30eb280c0 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 20 Sep 2006 21:13:26 +0000 Subject: --- system/libraries/Validation.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'system/libraries/Validation.php') diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index 227cf9f9a..065e7a2d5 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -246,8 +246,8 @@ class CI_Validation { { $rule = substr($rule, 9); $callback = TRUE; - } - + } + // Strip the parameter (if exists) from the rule // Rules can contain a parameter: max_length[5] $param = FALSE; @@ -265,13 +265,14 @@ class CI_Validation { continue; } - $result = $this->obj->$rule($_POST[$field], $param); + $result = $this->obj->$rule($_POST[$field], $param); - // If the field isn't requires we'll move on... - if ( ! in_array('required', $ex)) + // If the field isn't required and we just processed a callback we'll move on... + if ( ! in_array('required', $ex) AND $result !== FALSE) { - continue; + continue 2; } + } else { @@ -295,7 +296,7 @@ class CI_Validation { $result = $this->$rule($_POST[$field], $param); } - + // Did the rule test negatively? If so, grab the error. if ($result === FALSE) { @@ -323,8 +324,9 @@ class CI_Validation { // Add the error to the error array $this->_error_array[] = $message; continue 2; - } + } } + } $total_errors = count($this->_error_array); -- cgit v1.2.3-24-g4f1b