Welcome Guest, Not a member yet? Register   Sign In
Custom callback based on 2 fields

[eluser]Jhourlad Estrella[/eluser]
Hi, guys. My First time here. Anyway, I hope somebody can help me with my very simple problem with CI.

On my Login controller:

$this->form_validation->set_rules('f_username', 'Username', 'required|alpha_numeric|xss_clean|min_length[3]|max_length[12]');
$this->form_validation->set_rules('f_password', 'Password', 'required|min_length[8]|max_length[30]');

I am trying to find a way to make my login validation code ad CI compliant as possible so I want to do it using a custom callback function. Is there a place there I can do something to add a custom rule? I've already done this before without hassle but I lost all my codes recently.

Thanks in advanced!

create a custom function with your code.
Add that function to validation rules with a prefix of 'callback_'
eg. callback_checkUnique
That's all Smile

Happy coding,

[eluser]Neeraj Kumar[/eluser]
don't forget to add the validation function to your current controller Wink

Theme © iAndrew 2016 - Forum software by © MyBB