[eluser]kaejiavo[/eluser]
[quote author="rupin" date="1287745955"]The codeigniter documentation on validation rules suggests that we can build own callback functions for validations.
These functions reside in the controller class, and can be accessed directly when appropriate URL is formed.
I tried to add a'_' before the function name, but then codeigniter wont run the validation rule because the rule would become something like this
$rules['username'] = "required|min_length[5]|max_length[12]|callback__CheckUsernameExists";
instead of
$rules['username'] = "required|min_length[5]|max_length[12]|callback_CheckUsernameExists";
How do I make the CheckUsernameExists method private?[/quote]
Hi rupin,
i am using the form validation exactly as in your first example and it works (using CI2.0)
Code:
$this->form_validation->set_rules('receiver_id', 'receiver_id', 'required|is_numeric|callback__receiver_check');
...
function _receiver_check($receiver_id)
{ ... }
Marco