From 0742fad5cb283693bf1ef0a63aa90bb6cb2927d8 Mon Sep 17 00:00:00 2001 From: Ahmedul Haque Abid Date: Thu, 9 Jan 2014 07:51:10 +0600 Subject: Changed $error_msg to $errors --- system/libraries/Form_validation.php | 8 ++++---- user_guide_src/source/libraries/form_validation.rst | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index e140bc46d..55ef28c80 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -150,10 +150,10 @@ class CI_Form_validation { * @param mixed $field * @param string $label * @param mixed $rules - * @param array $error_msg + * @param array $errors * @return CI_Form_validation */ - public function set_rules($field, $label = '', $rules = '', $error_msg = array()) + public function set_rules($field, $label = '', $rules = '', $errors = array()) { // No reason to set rules if we have no POST data // or a validation array has not been specified @@ -178,7 +178,7 @@ class CI_Form_validation { $label = isset($row['label']) ? $row['label'] : $row['field']; // Add the custom error message array - $error_msg = (isset($row['error_msg']) && is_array($row['error_msg']) ) ? $row['error_msg'] : array(); + $errors = (isset($row['error_msg']) && is_array($row['error_msg']) ) ? $row['error_msg'] : array(); // Here we go! $this->set_rules($row['field'], $label, $row['rules']); @@ -229,7 +229,7 @@ class CI_Form_validation { 'field' => $field, 'label' => $label, 'rules' => $rules, - 'error_msg' => $error_msg, + 'error_msg' => $errors, 'is_array' => $is_array, 'keys' => $indexes, 'postdata' => NULL, diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index f70877c02..671f97992 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -957,12 +957,12 @@ The following methods are intended for use in your controller. $this->form_validation->set_rules() =================================== - .. php:method:: set_rules ($field, $label = '', $rules = '') + .. php:method:: set_rules ($field, $label = '', $rules = '', $errors = array()) :param string $field: The field name :param string $label: The field label :param mixed $rules: The rules, as a string with rules separated by a pipe "|", or an array or rules. - :param array $error_msg: Custom error message on any rules for the current field only. (optional) + :param array $errors: Custom error message :rtype: Object Permits you to set validation rules, as described in the tutorial -- cgit v1.2.3-24-g4f1b