waifung0207 / ci_bootstrap_3

A multi-tenant website template based on CodeIgniter 3 with integration of some useful tools
MIT License
386 stars 316 forks source link

MY_Form_validation callbacks are not working with HMVC #55

Closed jromero-onclick closed 8 years ago

jromero-onclick commented 8 years ago

In order to make the callbacks work inside a module, MY_Form_validation should have a public property $CI and then add a reference to the controller after loading the form_validation library, just as wiredesignz explained in the documentation:

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc

<?php
/** application/libraries/MY_Form_validation **/ 
class MY_Form_validation extends CI_Form_validation 
{
    public $CI; // make the CI_Form_validation::CI property public
}
<?php
class Xyz extends MX_Controller 
{
    function __construct()
    {
        parent::__construct();

        $this->load->library('form_validation');
        $this->form_validation->CI =& $this;
    }
}
jromero-onclick commented 8 years ago

Also remember to move the file to the appropiated folder:

https://github.com/waifung0207/ci_bootstrap_3/issues/54

waifung0207 commented 8 years ago

Thanks for the issue, I will have a look and update in next version.