Welcome Guest, Not a member yet? Register   Sign In
Form Validation Callback
#7

@RBX

If you look at the rule and the actual method in the link I am referring as well as into the Form_validation library.

You will see that if you have a callback rule like this:


PHP Code:
$this->form_validation->set_rules('username''Username''callback_username_check'); 


Your method has to be :


PHP Code:
public function username_check($str)
 
    {
 
               ......
 
    

This is because the Form_validation library removes the first 9 characters from the callback method name in the rule, so it includes the underscore. So if you want your method name to start with an underscore you need to double it in the rule:

PHP Code:
$this->form_validation->set_rules('username''Username''callback__username_check');

.....


public function 
_username_check($str)

 
       {
..... 
A good decision is based on knowledge and not on numbers. - Plato

Reply


Messages In This Thread
Form Validation Callback - by RBX - 04-10-2017, 01:29 AM
RE: Form Validation Callback - by InsiteFX - 04-10-2017, 03:51 AM
RE: Form Validation Callback - by salain - 04-10-2017, 03:53 AM
RE: Form Validation Callback - by InsiteFX - 04-10-2017, 08:52 AM
RE: Form Validation Callback - by RBX - 04-10-2017, 11:02 AM
RE: Form Validation Callback - by Paradinight - 04-10-2017, 11:16 AM
RE: Form Validation Callback - by salain - 04-11-2017, 12:01 AM
RE: Form Validation Callback - by RBX - 04-11-2017, 08:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB