Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Cannot Add A Variable To The Form That Is Not In The Db

$
0
0
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 $names=array();
	public function getTheNames()
	{
		return $this->names;
	}	
	public function setTheNames($value)
	{
		$this->names = array_merge ($this->names, array($value));
	}
         public function rules()
	{
		return array(
			array('names', 'length', 'max'=>64),


Thank you anyone who has an idea!!

Viewing all articles
Browse latest Browse all 18717

Trending Articles