[eluser]thisischris[/eluser]
In the user guide, under form validation there is this example:
Code:
<?php
class Form extends CI_Controller {
function index()
{
... ... ...
}
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;
}
else
{
return TRUE;
}
}
}
?>
However how can I prevent the username_check being accessible from example.com/index.php/form/username_check
Adding a underscore to the method's name prevents it from being called when setting a rule.
Example: $this->form_validation->set_rules('username', 'username', 'callback_username_check|required');