Welcome Guest, Not a member yet? Register   Sign In
Validate Drop Down Selections
#16

[eluser]Petsoukos[/eluser]
Hm... I've got it running with drop down and it validates correctly as far I can tell.

I check the validation from on point only
Code:
$this->form_validation->set_rules('year', 'Year', 'trim|required|numeric|callback_datechecker');
$this->form_validation->set_rules('month', 'Month', 'trim|required|numeric');
$this->form_validation->set_rules('day', 'Day', 'trim|required|numeric');
The form validation on the year input.

The callback method:
Code:
function DateChecker() {
$y = $this->input->post('year');
$m = $this->input->post('month');
$d = $this->input->post('day');
    if(checkdate($m, $d, $y)) {            
        return true;
    } else {
        $this->form_validation->set_message('datechecker', 'Invalid Date!');
        return false;
    }
}

Can someone else confirm this? When for example I enter an erroneous date like 2010 02 31 (31 Feb ;-P ) I get the error message. Or any invalid date. If someone was so kind to review it for any loopholes or a trick to bypass it I would be greatfull.

Thanks!


Messages In This Thread
Validate Drop Down Selections - by El Forum - 09-01-2010, 08:57 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 10:55 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:00 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:14 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:20 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:26 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:42 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:50 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:59 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 01:21 PM
Validate Drop Down Selections - by El Forum - 09-01-2010, 01:23 PM
Validate Drop Down Selections - by El Forum - 09-01-2010, 01:35 PM
Validate Drop Down Selections - by El Forum - 09-01-2010, 04:06 PM
Validate Drop Down Selections - by El Forum - 09-01-2010, 05:54 PM
Validate Drop Down Selections - by El Forum - 09-02-2010, 12:35 AM
Validate Drop Down Selections - by El Forum - 09-02-2010, 08:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB