Welcome Guest, Not a member yet? Register   Sign In
Array Field Validation with Callback Function
#3

[eluser]Aken[/eluser]
Your callback function is checking every shift from/to combo on every call. So it will return false for every single pair if only one of them has an error. You need to have your callback only fire for that particular pair. You can use something like this:

Code:
// Callback rules in your $fromArray loop
$this->form_validation->set_rules('shift_from['.$i.']', 'Shift Start', 'callback_check_shifts['.$i.']');
$this->form_validation->set_rules('shift_to['.$i.']', 'Shift Start', 'callback_check_shifts['.$i.']');

public function check_shifts($input, $shift_set)
{
    // Do your check here, using $shift_set as the key number, replacing $i
}


Messages In This Thread
Array Field Validation with Callback Function - by El Forum - 10-09-2012, 09:00 AM
Array Field Validation with Callback Function - by El Forum - 10-09-2012, 10:51 PM
Array Field Validation with Callback Function - by El Forum - 10-09-2012, 11:12 PM
Array Field Validation with Callback Function - by El Forum - 10-09-2012, 11:32 PM
Array Field Validation with Callback Function - by El Forum - 10-10-2012, 01:41 AM
Array Field Validation with Callback Function - by El Forum - 10-11-2012, 12:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB