I doing form validation in CodeIgniter using Form Validation Library and my custom callbacks.
public function insert_user()
{
if($this->input->post('submit')) {
// load form validation library
$this->load->library('form_validation');
// configurations
$config = array(
array(
'field' => 'username',
'label' => 'Username',
'rules' => 'required|callback_username_check'
)
);
$this->form_validation->set_rules($config);
// .... continue ....
}
}
When method is public, it is working as expected.
public function username_check($username)
{
// do some stuffs here
}
When I make method as private, it is not working.
private function username_check($username)
{
// do some stuffs here
}
Why callbacks from private methods are not working?
Why I need this?
Public methods in CodeIgniter controllers are accessible by URLs like an example above
I don't want callback methods accessible publicly.