[eluser]Unknown[/eluser]
Hello,
I'm tring to validate a field using 2 custom functions callback, my code look like this:
Code:
function _set_rules(){
...
$rules['close_time_d'] = 'trim|callback_valid_date|callback_valid_date_after';
...
$this->validation->set_rules($rules);
...
}
Then, of course i defined valid_date and valid_date_after functions.
Only the first validation (valid_date) is performed, this sounds me strange. I checked validation library code and I found in run() function this:
Code:
// If the field isn't required and we just processed a callback we'll move on...
if ( ! in_array('required', $ex, TRUE) AND $result !== FALSE)
{
continue 2;
}
It sounds like if the field is not required, only the first callback function is processed... why? Is this a bug or someone could explain it to me?
For test I removed this lines from validation library and everything worked good.
Thank you.
G.