[eluser]TheFuzzy0ne[/eluser]
Your rules:
Code:
$this->form_validation->set_rules('cost-min', 'Cost Min', 'required|numeric'); // should always be lower than cost-max
$this->form_validation->set_rules('cost-max', 'Cost Max', 'required|numeric|callback__more_than[cost-min]'); // should always be higher
In your controller, add the following method.
Code:
function _more_than($str, $field='')
{
// Don't run bother checking if we have a form error on cost-min.
if (form_error('cost-min')) {
return true;
}
$str = intval($str);
$min = intval($this->input->post($field));
if ($str <= $min) {
$this->form_validation->set_message('_more_than', "The %s field must be more than {$min}.");
return false;
}
return true;
}
I've not tested it, but it should give you something to go on.
Hope this helps.