CodeIgniter Unable to Access Error Message Error
Posted
by 01010011
on Stack Overflow
See other posts from Stack Overflow
or by 01010011
Published on 2010-04-18T19:49:01Z
Indexed on
2010/04/18
19:53 UTC
Read the original article
Hit count: 436
Hi, I've created this registration form for registering new users to a website using CodeIgniter. My problem is, whenever I enter a username that already exists in my database, instead of giving me my error message which explains this to the user, it instead gives me this error message:
Unable to access an error message corresponding to your field name
Here are snippets of the code from my controller. Any assistance will be appreciated:
function register()
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username','trim|required|alpha_numeric|min_length[6]|xss_clean|strtolower|callback_username_not_exists);
...
}
function username_not_exists($username)
{
$this->form_validation->set_message('username','That %s already exists.');
if($this->User_model->check_exists_username($username))
{
return false;
}
else
{
return true;
}
© Stack Overflow or respective owner