diff options
author | Raul Baldner Junior <raul_baldner_junior@hotmail.com> | 2012-10-11 16:32:23 +0200 |
---|---|---|
committer | Raul Baldner Junior <raul_baldner_junior@hotmail.com> | 2012-10-11 16:32:23 +0200 |
commit | f38564d739455f46eb38bcbfaa8e255d0a50defe (patch) | |
tree | e9c4f937c31cc19200b055808edd6409acea21bc /system/libraries | |
parent | 06e9d1d7a4c979a43f9f8fa437526b6c7a547cec (diff) |
New form_validation rule: 'differs'
Added new validation rule 'differs'. It checks if the value of a field differs from the value of another field.
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Form_validation.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index fccc12afa..6db5bb495 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -971,6 +971,19 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** + * Differs from another field + * + * @param string + * @param string field + * @return bool + */ + public function differs($str, $field) + { + return ! (isset($this->_field_data[$field]) && $this->_field_data[$field]['postdata'] === $str); + } + + // -------------------------------------------------------------------- + /** * Is Unique * * Check if the input value doesn't already exist |