Is there a way to require an array of elements in the rules() method of a Yii model?
For example:
public function rules()
{
return array(
array('question[0],question[1],...,question[k]','require'),
);
}
I have been running into situations where I need to validate several arrays of elements
coming from a form and I can't seem to find a good way of going about it other than doing the above. I have the same problem when specifying attributeLables(). If anyone has some advice or a better way of doing this I would really appreciate it.
question[x]? Are they class attributes ? and by Yii model you re referring to what?CActiveRecord,CfromModelorCModel?question[x]are name values of the forms I am submitting. The Yii model I mention are specifically CFormModels.