• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.