has-manycakephp-2.4formhelper

Why cakephp FormHelper::input() doesn't create a multiple select input on a hasMany association?


I have a model for which exists some model associations whose hasmay and HABTM.

In the edit view,

<?php echo $this->Form->input('myHABTMModel'); ?>

create a select>multiple input, but

<?php echo $this->Form->input('myHasManyModel'); ?>

create a select input with unique choice.

Why ? It is normal ? I must specify ? Or something is wrong somewhere ?


Solution

  • Indeed, it must specify the multiplicity in the input method options :

    <?php echo $this->Form->input('myHasManyModel',array('multiple'=>'multiple')); ?>