Welcome Guest, Not a member yet? Register   Sign In
Crazy with callbacks
#10

(06-10-2015, 07:01 AM)CroNiX Wrote: I think it's because you're setting the error message OUTSIDE of where the actual validation rule (username_check_exist) is defined.
In your auth:

PHP Code:
public function username_check($username) {
 
   $account $this->load->database('account'TRUE);
 
   $account->where('login',$username);
 
   $query $account->get('account');
 
   return ($query->num_rows() > 0);  //returns TRUE/FALSE


In your controller:

PHP Code:
public function username_check_exist($username) {
 
 //set the error message for THIS validation rule
 
 $this->form_validation->set_message('username_check_exist''L´username è già utilizzato.');

 
 //just return result from auth::username_check(), which will be true/false
 
 return $this->auth->username_check($username);



I change the auth and controller with your code, meanwhile, I thank you for your time that you're offering me
And now I can tell you that is not working. Big Grin It does not display the error and still launches the query  Confused

As absurd thing. All other rules of the same field are used properly
Reply


Messages In This Thread
Crazy with callbacks - by StratoKyke - 06-10-2015, 05:37 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 05:59 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 06:34 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 06:37 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 06:41 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 06:45 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 06:49 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 06:52 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 07:01 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 07:07 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 07:12 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 07:23 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 07:38 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 08:38 AM
RE: Crazy with callbacks - by Blair2004 - 06-10-2015, 11:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB