In my form I want add an hidden attribute with activeHiddenField, I need it to be an array, is it possible?
I try to define it in the model with:
public $myArray;
i tried also:
public $myArray=array();
and then in the view i write:
echo CHtml::activeHiddenField($model, 'myArray');
but after I set it with values for example:
$model->myArray[0]='test0';
$model->myArray[1]='test1';
in the following render of the view I have the error message:
[i]
htmlspecialchars() expects parameter 1 to be string, array given
Source File
…Yii\yii\framework\web\helpers\CHtml.php(66)
00054: */
00055: public static $count=0;
00056:
00057: /**
00058: * Encodes special characters into HTML entities.
00059: * The {@link CApplication::charset application charset} will be used for encoding.
00060: * @param string data to be encoded
00061: * @return string the encoded data
00062: * @see http://www.php.net/manual/en/function.htmlspecialchars.php
00063: */
00064: public static function encode($text)
00065: {
00066: return htmlspecialchars($text,ENT_QUOTES,Yii::app()->charset);
00067: }
00068:
.
.
.
[/i]