Welcome Guest, Not a member yet? Register   Sign In
Validation Class Callback question
#1

[eluser]gedev2006[/eluser]
Hi

Im writing a login module, using the form validation class to a) check username field is filled in ( required ) b) use a callback to check the user exists c) check password is entered d) check password is valid for the user

Is it possible when calling the password callback to actually parse over the username as well as the password string? here is the code i have so far:

Code:
// Set validation rules
            $_rules = array (
                        array ( 'field' => 'username', 'label' => 'Username', 'rules' => 'required|callback_valid_user' ),
                        array ( 'field' => 'password', 'label' => 'Password', 'rules' => 'required|callback_valid_password' )
                        );
                        
            $this->form_validation->set_rules ( $_rules );

see all this is doing for the password is checking its required then calling "valid_password" but its only parsing the password field, and i need it to send over the username as well

thanks
#2

[eluser]stef25[/eluser]
A while back I asked if you could pass paramaters along with a callback function, which I think is what you are looking for. Someone referered me to this post: http://ellislab.com/forums/viewthread/125515/#620714




Theme © iAndrew 2016 - Forum software by © MyBB