I want to use a function to validate dates with a parameter...but I have all validations in a config array.
config = array(
'page1/send' => array(
array(
'field' => 'name',
'label' => 'lang:name',
'rules' => 'required'
)
),
'page2/send' => array(
array(
'field' => 'name',
'label' => 'lang:name',
'rules' => 'required'
),
array(
'field' => 'date1',
'label' => 'lang:date',
'rules' => 'required|'
)
array(
'field' => 'date2',
'label' => 'lang:date',
'rules' => 'required|callback_date_compare'
)
),
I would like to pass an additional parameter to "callback_date_compare" in this case the other field (date1).
Without setting the rules in an array I could do it in this way if "$date1" is the value of the post['date1'] and it worked perfectly :
$this->form_validation->set_rules('date2', 'lang:date', 'required|callback_date_compare[' . $date1 . ']');
I need to do it inside the array because I have all validations inside it and I tried to do it the same way inside the $config array but it didn´t work, something like:
array(
'field' => 'date2',
'label' => 'lang:date',
'rules' => 'required|callback_date_compare[date1]'
)
Any help is appreciated.