Welcome Guest, Not a member yet? Register   Sign In
I just can't for the life of me get validation callbacks to work
#1

[eluser]Unknown[/eluser]
Hi all and happy easter!

I just can't seem to get validation callbacks to work, I'm either being really stupid or I'm being really stupid Smile

CI 1.6.1

Here is my trimmed down code for display purposes, it will eventually become part of a user profile section where they can change their password. So current pass, new pass and confirm pass fields. I have added a few dies in the code to see what it is doing and the callback (_checkpass) never gets fired?!

edit: I can get normal validations to work fine by the way.

Code:
function settings() {

    # lib
    $this->load->library('validation');

    # rules
    $rules['password']    = "callback__checkpass|trim";
    $this->validation->set_rules($rules);

    # fields
    $fields['password']    = 'Password';
    $this->validation->set_fields($fields);

    # callback
    function _checkpass($password)
    {
        die('callback');
    }

    # do validation check
    if ($this->validation->run())
    {
        die('success');
    }
    else
    {
        $this->load->view('users/settings');
    }

}

Any help would be greatly appreciated.

Cheers,
Steve


Messages In This Thread
I just can't for the life of me get validation callbacks to work - by El Forum - 03-21-2008, 10:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB