Welcome Guest, Not a member yet? Register   Sign In
Can somebody tell me where I'm going wrong with "callback_" ?
#5

[eluser]bretticus[/eluser]
Actually, it appears you may be new enough that "drinking the proverbial Kool Aid" of OOP is a just bit too foreign for you. That's all. I suggest learning the basics of OOP. All PHP coders eventually head in that direction sooner or later. Smile Once you get that under your belt, this framework won't seem too daunting.

2 things about your _age_check method.

Code:
function _age_check() {            
            $d = $this->input->post('dob_d');
            $m = $this->input->post('dob_m');
            $y = $this->input->post('dob_y');
            if($d != "" && $m != "" && $y != "") { // If date fields are not empty, then proceed
                // PREP DATE
                $dob = date("M", $m)." ".$d.", ".$y;

                // PROCEED WITH VALIDATION
                $then = strtotime($dob); // Timestamp from DOB
                $min = strtotime('+16 years', $then); // DOB Timestamp + 16 years
                if(time() < $min) {
                    $this->validation->set_message('age_check', 'The %s field can not be the word "test"');
                    return FALSE; // Under 16;
                } else {
                    $this->validation->set_message('age_check', 'The %s field can not be the word "test"');
                    return TRUE; // Over 16;
                }    
            } else {
                //return "Date of Birth is incomplete"; //must return TRUE or FALSE (not text)
                return FALSE;
            }
        }

See comments in code above.

Also, in your view I see no call to actually print out the errors that the validation lib may find.

Good luck!

P.S. This is a good series (Allbeit a little boring to watch.)


Messages In This Thread
Can somebody tell me where I'm going wrong with "callback_" ? - by El Forum - 10-17-2009, 07:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB