summaryrefslogtreecommitdiffstats
path: root/system/libraries/Form_validation.php
diff options
context:
space:
mode:
authorRick Ellis <rick.ellis@ellislab.com>2008-10-19 00:58:57 +0200
committerRick Ellis <rick.ellis@ellislab.com>2008-10-19 00:58:57 +0200
commit3fb0a2afe414b8447c8f063361e7c99e7cedf930 (patch)
treeb1568c18f3bad9e6f3a8aae4fae6ce376a9fff1d /system/libraries/Form_validation.php
parenta2879365f54ca683b51134bd787fbb1a5e4c7be5 (diff)
Fixed a bug in which the "isset" error message was being trigged by the "required" rule.
Diffstat (limited to 'system/libraries/Form_validation.php')
-rw-r--r--system/libraries/Form_validation.php11
1 files changed, 7 insertions, 4 deletions
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