Welcome Guest, Not a member yet? Register   Sign In
validation not working
#7

[eluser]pickupman[/eluser]
Glad you got it working. Please note that the validation library has been deprecated 1.7.2 (removed in 2.0beta). You should form_validation library instead.

Also, it may be wise to set your username_check to a private method, as someone could visit that page right now. Or change your syntax to
Code:
$this->form_validation->set_rules('username', 'username', 'required|trim|callback__username_check');
$this->form_validation->set_rules('password', 'password', 'required|trim');
$this->form_validation->set_rules('passconf', 'password confirmation', 'required|trim|matches[password]');
$this->form_validation->set_rules('email', 'email address', 'required|trim|valid_email');

//Callback
function _username_check($str){
  if($str == 'test'){
     $this->form_validation->set_message('_username_check', 'The %s field can not be the word "test".');
     return FALSE;
  }
  return TRUE;
}

Also for those of us helping, using the code button in the editor will format your code so we can copy and paste it.


Messages In This Thread
validation not working - by El Forum - 11-21-2010, 10:06 PM
validation not working - by El Forum - 11-21-2010, 10:39 PM
validation not working - by El Forum - 11-21-2010, 10:45 PM
validation not working - by El Forum - 11-21-2010, 11:15 PM
validation not working - by El Forum - 11-21-2010, 11:41 PM
validation not working - by El Forum - 11-21-2010, 11:49 PM
validation not working - by El Forum - 11-22-2010, 08:30 AM
validation not working - by El Forum - 11-23-2010, 01:32 AM
validation not working - by El Forum - 11-23-2010, 07:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB