Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!
At page i have input box:
XML
<input style="width: 13px;" name="rules" id="User_agreement" value="1" type="checkbox">
       
        <?=form_error('rules')?>



And at side php there is validation code:

PHP
 <?$this->form_validation->set_rules('rules', 'Согласие с правилами', 'required|callback__rules_accept');

function _rules_accept($check){

        if($this->input->post('rules') && $this->input->post('rules') == 1) {
            return true;
        }

        $this->form_validation->set_message('_email_unic', 'Необходимо подтвердить ваше согласие с правилами использования');
        return false;
    }
?>


But it does not work! Why? Can you explain me?
Posted
Updated 7-May-13 10:34am
v2

1 solution

Because you started the name of your callback function with "_". Try changing the name to "rules_accept" and take out the extra "_" to make it "callback_rules_accept".
 
Share this answer
 
Comments
Jardin1 7-May-13 17:16pm    
Same does not work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900