Welcome Guest, Not a member yet? Register   Sign In
Callback parameters are not printing correct values.
#1

[eluser]Ninjabear[/eluser]
MY_Controller
Code:
//Check that end date is after start date.
            function _check_start_end_date($start_date,$end_date)
            {
            echo $start_date.' - '.$end_date;
          
                    if( empty($start_date))
                            return true;
          
                    if(strtotime($end_date) > strtotime($start_date))
                    {
                      return true;
                    }
                    $this->form_validation->set_message('_check_start_end_date', 'The start date must be before the end date.');
                    return false;
            }

The output from the echo $start_date.' - '.$end_date; is "2012-12-26 - 2012-12-26" even though the dates coming back from post() are "2012-12-17 - 2012-12-26". Furthermore this function has worked fine in the past and I've called it in this way lots of times. I'm assuming that the param below in brackets is the second param to function right? The first param is the field value in question.

Controller
Code:
$this->form_validation->set_rules("date_work_began","Date work began","trim|required|callback__Valid_Date_Format");
            $this->form_validation->set_rules("date_work_ended","Date work ended","trim|callback__Valid_Date_Format|callback__check_start_end_date[{$this->input->post('date_work_ended')}]" );

So the result from the function is false or "The start date must be before the end date.". But it should be true.


Messages In This Thread
Callback parameters are not printing correct values. - by El Forum - 01-07-2013, 09:48 AM
Callback parameters are not printing correct values. - by El Forum - 01-07-2013, 10:29 AM
Callback parameters are not printing correct values. - by El Forum - 01-07-2013, 10:31 AM
Callback parameters are not printing correct values. - by El Forum - 01-08-2013, 03:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB