Hi!
I need to create some rows in a model based on user’s selection in 2 checkboxlists. I have a model “atributos” who stores a list of products attributes like size or color.
Example:
id------type------value
1-------color------red
2-------color------blue
3-------color------green
4-------size------S
4-------size------M
4-------size------XL
In view I have a separated checkbox for each type, users select colors and sizes avaliable for this product.
<div class="row">
<?php echo $form->checkBoxList($atributos, 'id_atributo', CHtml::listData(Atributos::model()-> findAllByAttributes(array('tipo'=>'color')), 'id_atributo','valor'))?>
<?php echo $form->error($atributos,'id_atributo'); ?>
</div>
<h3>Tallas</h3>
<div class="row">
<?php echo $form->checkBoxList($atributos, 'id_atributo', CHtml::listData(Atributos::model()-> findAllByAttributes(array('tipo'=>'talla')), 'id_atributo','valor'))?>
<?php echo $form->error($atributos,'id_atributo'); ?>
</div>
My problem is: In controller I only recibe values of the last checkboxlist.
print_r($_POST['Atributos']);
I think is because two checklists has the same name, but I don’t know how solve this…
Sorry for my english and thanks!