Welcome Guest, Not a member yet? Register   Sign In
[SOLVED!] HMVC + CI20 + Callback problem!
#1

[eluser]eokorie[/eluser]
Anyone managed to get form validation callbacks in CodeIgniter 2.0 working with HMVC? I am aware that there were are some topics on the very same subject but not sure if they will work for CI2.0?

Anyway encounter this? All have to mention that I tried the solutions and callbacks are still not working...

Update:
Sorted my problem out..
#2

[eluser]jkevinburton[/eluser]
I am having the problem now... How did you sort it out?
#3

[eluser]jkevinburton[/eluser]
Here is the solution...
Code:
$this->load->library('form_validation');
$this->form_validation->CI =& $this;
#4

[eluser]danmontgomery[/eluser]
You can also use:

Code:
$this->load->library('form_validation');
if($this->form_validation->run($this)) {
#5

[eluser]Sven Delle[/eluser]
This DO NOT fix it!
#6

[eluser]wiredesignz[/eluser]
Code:
<?php
/** application/libraries/MY_Form_validation **/
class MY_Form_validation extends CI_Form_validation
{
    public $CI;
}

<?php
class Xyz extends MX_Controller
{
    function __construct()
    {
        parent::__construct();
        
        $this->load->library('form_validation');
        $this->form_validation->CI =& $this;
    }
}

@Sven, It might help to read the WIKI before posting...
https://bitbucket.org/wiredesignz/codeig.../wiki/Home
#7

[eluser]Sven Delle[/eluser]
Totally agree! And I did.

I just simply made the mistake of separating the piped elements into individual parameters as in:
Code:
$this->form_validation->set_rules('username', 'Username', 'required', 'callback_check_default_username');

Instead of:
Code:
$this->form_validation->set_rules('username', 'Username', 'required|callback_check_default_username');

So what I ended up doing, was trying ALL SORTS of different solutions, instead of just replacing 3 characters with one. Don't know if this sound familiar to others.

So more attention to detail is a good thing : ).

And by the way; I do not extend MX_Controller but CI_Controller, so I guess this is not necessary?




Theme © iAndrew 2016 - Forum software by © MyBB