Thanks sidtj for the great extension…It seems exactly what am looking for. I can however not seem to have it work when using it in a form capturing related data.
Here are my rules
array(‘user_id’, ‘numerical’, ‘integerOnly’=>true),
array('event_id, campaign_id', 'length', 'max'=>7),
array('q1, q2, q3, q4, q5, q6, q7, q8, q9, q10', 'length', 'max'=>100),
array('q1', 'ext.YiiConditionalValidator',
'if' => array(
array('event.code_id', 'compare', 'compareValue'=>"303"),
),
'then' => array(
array('q1', 'required'),
),
),...
and here are the relations
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'user' => array(self::BELONGS_TO, 'Users', 'user_id'),
'event' => array(self::BELONGS_TO, 'EventsAll', 'event_id'),
);
}
When I try to save I get the following error though…
AdhocVoc has not a relation named "event". Check the YiiConditionalValidator rule that is using the attribute name "event.code_id".
Where am i going wrong?