[eluser]Simple Gifts[/eluser]
I have a form field that may be blank, but if it isn't blank, it requires several callbacks to review it.
Here's where I set the rule:
$this->form_validation->set_rules('txtSplitCC', 'Split Payments/CC',
'trim|'.
'callback_stripCommas|'.
'callback_verifySplits['.$curTotal.',false]');
Function stripCommas always returns a string, so it never returns false.
The second callback is never called. It appears that if a field is not required, only the first callback is called in the form validation code.
Looking into codeIgniter's system function (version 2.1.3) _execute($row, $rules, $postdata = NULL, $cycles = 0), file Form_Validation.php, it appears that all callbacks are skipped after the first callback inside the rules processing loop:
Code:
// If the field isn't required and we just processed a callback we'll move on...
if ( ! in_array('required', $rules, TRUE) AND $result !== FALSE)
{
continue;
}
This is a problem, since I need to work through several callbacks to fully review the input. Any suggestions?
Thanks.