From 3fb0a2afe414b8447c8f063361e7c99e7cedf930 Mon Sep 17 00:00:00 2001 From: Rick Ellis Date: Sat, 18 Oct 2008 22:58:57 +0000 Subject: Fixed a bug in which the "isset" error message was being trigged by the "required" rule. --- system/libraries/Form_validation.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'system') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 4f3ffd0d3..1215e13fd 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -508,19 +508,22 @@ class CI_Form_validation { // Isset Test. Typically this rule will only apply to checkboxes. if (is_null($postdata) AND $callback == FALSE) - { + { if (in_array('isset', $rules, TRUE) OR in_array('required', $rules)) { - if ( ! isset($this->_error_messages['isset'])) + // Set the message type + $type = (in_array('required', $rules)) ? 'required' : 'isset'; + + if ( ! isset($this->_error_messages[$type])) { - if (FALSE === ($line = $this->CI->lang->line('isset'))) + if (FALSE === ($line = $this->CI->lang->line($type))) { $line = 'The field was not set'; } } else { - $line = $this->_error_messages['isset']; + $line = $this->_error_messages[$type]; } // Build the error message -- cgit v1.2.3-24-g4f1b