Welcome Guest, Not a member yet? Register   Sign In
Problems with extending CI_Form_validation

(07-31-2017, 12:32 AM)Martin7483 Wrote: How are you loading the validation library?

PHP Code:
$autoload['libraries'] = array(

Try using the subclass_prefix MY_

Regarding problem #1, everything looked OK to me the way you handled it in the beginning, except how you refer to the callback function.
PHP Code:

The function itself should keep the name 'scanEmail'.

That approach will only look for the method scanEmail in the controller where the rule was set.

(07-31-2017, 02:38 AM)Martin7483 Wrote: Try using the subclass_prefix MY_

if I set the prefix, then I should change my Model and core Controller which I made by myself. which I don't want this happen.

Is this bug? because shouldn't be any force to have a prefix and suppose to work!

If you extend a core library by using the MY_ prefix, the extended library is loaded with the original name. So there is no need for changing your controllers or models.
When you load the Form_validation library, CI will first check if there is a MY_Form_validation.php in application/libraries. If that isn't the case, it will load the core library from system/libraries.

Theme © iAndrew 2016 - Forum software by © MyBB