[eluser]LifeSteala[/eluser]
I have a form, with Textarea (Description), Input (Due Date), Textarea (Internal Owner) and Input (External Owner).
I set the rule and field for description..
I created a callback function for this reason:
If description is filled in, then there MUST be a date and the Internal OR External owner must be set before it goes into the database.
Code is unfinished but i'll post it anyways. I get this error:
Unable to access an error message corresponding to your field name.
Code:
$this->_loadViews($data, $viewQu);
$rules['nextactdesc'] = "callback__nextAction";
$this->validation->set_rules($rules);
$fields['nextactdesc'] = "Next Action Description";
$this->validation->set_fields($fields);
if ($this->validation->run() == FALSE)
{
$this->_loadViews($data, $viewQu);
}
else
{
echo "success";
}
function _nextAction($nextActionField)
{
if (!empty($nextActionField))
{
if ((empty($_POST['duedate'])))
{
$this->validation->set_message('nextactdesc', 'A date is required.');
return FALSE;
}
else
{
if (empty($_POST['internalowner']) && empty($_POST['externalowner']))
{
$this->validation->set_message('nextactdesc', 'An internal or external owner is required');
return FALSE;
}
}
}
else
{
return TRUE;
}
}
Can anyone point out what i'm doing wrong please? Cheers