[eluser]CroNiX[/eluser]
You can pass additional parameters to your callback function.
If your rule is set like:
Code:
//notice parameter passed in brackets
$this->form_validation->set_rules('field', 'field name', 'cash_flow_check_values[6]');
And your validation rules was like:
Code:
public function cash_flow_check_values($field_value, $parameters)
{
echo $field_value; //value of whatever field this rule was run on
echo $parameters; // will be "6", and it will always be a string
}
This isn't documented in the user guide afaik, but if you look at the validation class for the validation rules they created that allow parameters (like min_length, etc), that's how they are doing it. So you could pass your array key here when you are "bulk" setting your rules.
Edit: actually the user guide does mention it for the validation callbacks:
Quote:If you need to receive an extra parameter in your callback function, just add it normally after the function name between square brackets, as in: "callback_foo[bar]", then it will be passed as the second argument of your callback function.