[eluser]Cro_Crx[/eluser]
Hey timaksu
You can write a really short callback function to do that
In your validation rules you would have something like this
Code:
$this->form_validation->set_rules('field', 'Field Name', 'callback__check_if_exists');
Then just write a callback function. Notice how i've put another underscore, this keeps the function private so it can't be accessed externally by a user directly.
Code:
function _check_if_exists()
{
$this->form_validation->set_rules('_check_if_exists', 'Username already exists');
return (!$this->user_model->exists($str));
// we return the opposite, so if the user exists we return false and true if they don't exist.
}