Welcome Guest, Not a member yet? Register   Sign In
Callbacks for own Validation Functions not working (bug?)
#1

[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
#2

[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.
#3

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

[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/




Theme © iAndrew 2016 - Forum software by © MyBB