When I add a variable, that is not in the DB, to my model it does not show up from a form submit unless I have the rule for it defined. But when I add it to the rules, the $model->save() results in mb_strlen() expects parameter 1 to be string, array given. The variable is an array and I’m using checkboxlist widget in the form view.
Here’s how the array is declared in my model:
public function getTheNames()
public function setTheNames($value)
$this->names = array_merge ($this->names, array($value));
public function rules()
array('names', 'length', 'max'=>64),
Thanks for the advise! Before I read this I solved it by putting the non-DB array into a CFormModel and created a new object in the model and passed it to the form view. I’m guessing I didn’t have to do all this and just could have made it safe.
class Tabnames extends CFormModel