[eluser]Unknown[/eluser]
Is there a cleaner way to use the Validation class to check two fields to see if they are valid together?
At the moment I do something like the following:
Code:
$rules['username'] = 'trim|required';
$rules['password'] = 'trim|required|callback__check_combo|sha1';
function _check_combo($val)
{
// There are some DB calls usually but for the sake of
// simplicity im just going to type it out
if ($this->input->post('username') == 'bob' && sha1($val) == 'cow')
return TRUE;
return FALSE;
}
I was wondering if there was a cleaner way to do this? Because atm I'm trusting the the username validation will be done first. And other than that, if there is a problem with username, it will still call the _check_combo function (as it should), but I don't want it to work this way.
Thank you