CodeIgniter Forums
Callbacks for own Validation Functions not working (bug?) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Callbacks for own Validation Functions not working (bug?) (/thread-45500.html)



Callbacks for own Validation Functions not working (bug?) - El Forum - 09-23-2011

[eluser]Unknown[/eluser]
I used the code from the documentation, but it wont work.

Code:
function register(){
...
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required|callback_username_check');
...
}


function username_check($str)
{
echo "debug: username_check called";

$this->form_validation->set_message('username_check', 'The %s field can not be the word "test"');
return FALSE;
}

I got an validation-error if the username field is empty (because of the "required" validation) so validation is working, but not with my custom validation, if i enter something the custom callback for validating is never called (i dont see the message, and i don't see the debug echo).

My environment is wampserver for windows with php: 5.2.5
and codeigniter is ver. 2.0.3

Am i doing something wrong or is this realy a bug?

Thanks for your help


Callbacks for own Validation Functions not working (bug?) - El Forum - 06-05-2012

[eluser]bennyhill[/eluser]
Did you figure this out. I can't get callbacks in validation to work either. My other validation runs, just not callbacks.


Callbacks for own Validation Functions not working (bug?) - El Forum - 06-05-2012

[eluser]CroNiX[/eluser]
Post where you set the validation rules along with your callback function.


Callbacks for own Validation Functions not working (bug?) - El Forum - 06-05-2012

[eluser]bennyhill[/eluser]
[quote author="CroNiX" date="1338932323"]Post where you set the validation rules along with your callback function.[/quote]

Cronix, I created another thread. My code is there.

http://ellislab.com/forums/viewthread/218664/