listBox not working


I have a CActiveForm with the following:

<?php echo $form->listBox($model, 'categories', Category::getCategoriesOptions()); ?>

The listbox displays correctly. However, when I submit the form, the attribute ‘categories’ does not reach the controller. In the controller I have this:


But I receive this error:

PHP notice. Undefined index: categories

All the other form attributes reach the controller except this listBox. I don’t know what is happening

I found the solution to this error. It’s funny, I had to select some items from the listBox, this is why it didn’t worked!!