submitting array

Hi there

first of all - sorry my English

How I can create form elements for submitting array?

I want to create something like this

<lable>Val 1</label><input name="arr[]" type="text"/><br/>

<lable>Val 2</label><input name="arr[]" type="text"/><br/>

<lable>Val 3</label><input name="arr[]" type="text"/><br/>


I’d tried to use


<?php echo CHtml::activeTextField($model,'arr[]'); ?>


but I get next HTML code


<input type=text name=Model[][arr]>


Is there a way to do this with Yii?



try following~


try with

this doesn’t work

Sorry I do not fully described what I need.

This don’t help me, I mean it works well but not for my situation,

but it gave me the idea.

    <div class="simple keyword_container">

        <?php $list = CHtml::listData(Keyword::model()->findAll(), 'id', 'name'); ?>

        <?php echo CHtml::activeLabelEx($model,'keyword'); ?>

        <?php echo CHtml::dropDownList('Domain[Keyword_ids][]', '',$list); ?>

        <?php echo CHtml::button('Remove',array('style'=>'display:none;')); ?>


    <div class="simple">

        <?php echo CHtml::activeLabelEx($model,'&nbsp;'); ?>

        <?php echo CHtml::button('Add more keywords', array('id'=>'add_more_keywords'));?>


this simple changes with simple JS


    var b = $('.keyword_container:first');

    var count = 1;

    function addKeyword(){

        var cb = b.clone();

        var el = cb.children('select');






    function removeKeyword(){





allowed me to dynamically add/remove elements to/from the form

uuu, is too much for me, ha ha ha

see this

maybe help you

good luck