public function validate($form_data)
{
$errs = array();
if (!@$form_data['outcome']) {
$errs['outcome'] = 'Please select an outcome';
}
$outcome = models\TicketAssignOutcomeOption::model()->findByPk((int) $form_data['outcome']);
if ($outcome && $outcome->followup) {
// validate outcome fields
foreach (array('followup_quantity' => 'follow up quantity', 'followup_period' => 'follow up period', 'clinic_location' => 'clinic location') as $k => $v) {
if (!@$form_data[$k]) {
$errs[$k] = "Please select {$v}";
}
}
}
return $errs;
}