Welcome Guest, Not a member yet? Register   Sign In
Can you validate a condition without associating a field name and callback?
#2

[eluser]hal10001[/eluser]
Well, the documentation is a little short in this area, but it turns out that your rule name doesn't really need to match your field name. You can do something like this:

Code:
$this->form_validation->set_rules('is_valid_user', '', 'callback__is_valid_user');

The trick is that because is_valid_user is not a form field, you are passing no string value into your callback function. However, whatever post values were sent through are still available in your callback, so you can just use those to do whatever you need.

Code:
function _is_valid_user()
{
    $user_login_id = $this->input->post('user_login_id');
    $user_password = $this->input->post('user_password');
    
    // do something and return true or false;
}


Messages In This Thread
Can you validate a condition without associating a field name and callback? - by El Forum - 03-10-2009, 09:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB