From 1b1b67693060ecb6dd399ea6aee4a5503d96adda Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 15 Jul 2011 19:37:31 -0600 Subject: enable use of param in a callback rule, on behalf of marcoscoelho. --- system/libraries/Form_validation.php | 2 +- user_guide/changelog.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index d370d75ee..fd95d76fa 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -488,7 +488,7 @@ class CI_Form_validation { if ( ! in_array('required', $rules) AND is_null($postdata)) { // Before we bail out, does the rule contain a callback? - if (preg_match("/(callback_\w+)/", implode(' ', $rules), $match)) + if (preg_match("/(callback_\w+(\[.*?\])?)/", implode(' ', $rules), $match)) { $callback = TRUE; $rules = (array('1' => $match[1])); diff --git a/user_guide/changelog.html b/user_guide/changelog.html index a924edc9c..8a6fea748 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -75,6 +75,7 @@ Change Log
  • Removed internal usage of the EXT constant.
  • Visual updates to the welcome_message view file and default error templates. Thanks to danijelb for the pull request.
  • Added insert_batch() function to the PostgreSQL database driver. Thanks to epallerols for the patch.
  • +
  • Callback validation rules can now accept parameters like any other validation rule.
  • Helpers -- cgit v1.2.3-24-g4f1b