About Generating Chtml Textfield

Hi all,

I have been using Yii for a while and I really enjoy developing website with it.

I have a question about generating CHtml Textfield.

I am not sure how to describe this question, how can I generate a Yii form like the following?




<input type="text" name="MyForm[mytext][]" ><br>

<input type="text" name="MyForm[mytext][]" ><br>

<input type="text" name="MyForm[mytext][]" ><br>

<input type="text" name="MyForm[mytext][]" ><br>

<br>

<input type="button" value="Add more textbox"> // Please ignore this part



The form should be able to send a number of textboxes as an array.

Please help.

Regards,

Ron


echo CHtml::textField('name[]',$value);

or using a model (CActiveForm,CHtml)


echo CHtml::activeTextField($model,'attribute[]');

which results in code similar to what you are looking for.

Moved from General Discussion for Yii 2.0 to General Discussion for Yii 1.1.x.