[eluser]stef25[/eluser]
I've done this dozens of times before but for some reason the validation function in the code below doesn't get called. $k is the value of the name attribute of a form field. The IF condition gets matched, tested with the die(). The die($str) in the duration_check never shows though;
Can anyone see why?
Code:
function refresh()
{
$this->load->library('form_validation');
//loop through all duration fields, make sure they are not zero
foreach($_POST as $k => $v)
{
if( strpos($k, "prod_duration") === 0)
{
//die('here');
$this->form_validation->set_rules($k, 'Duration', 'callback_duration_check');
}
}
}
function duration_check($str)
{
die($str);
}