我遇到了FormHelper的麻烦。
我有我的第一个模型“游戏”。看起来是这样的:
class Game extends AppModel{
public $hasMany = array('gamesauthors','gameseditors','gamesillustrators','gamesgametypes');
public $hasAndBelongsToMany =
array("Author" =>
array('joinTable' => 'gamesauthors'),
"Editor" =>
array('joinTable' => 'gameseditors'),
"Illustrator" =>
array("joinTable" => 'gamesillustrators'),
"Gametype" =>
array('joinTable' => 'gamesgametypes'));
public $belongsTo = array('Collection','Distributor');
}当我尝试使用该代码在复选框中添加“游戏类型”时:
<?= $this->Form->input('gametypes', array("label" => "Type(s) de jeu:", 'option' => $types, 'multiple' => 'checkbox')); ?>这是一个文本表单而不是复选框..。
我真的不明白。这是唯一不能用的东西。所有其他模型(作者,编辑.)不仅是对的..。我检查了所有的代码很多次了。和其他模特一样..。
如果需要的话,我可以发布更多的信息(var_dump,调试,任何东西!)
如果有人有主意..。请!
谢谢各位
发布于 2014-09-26 20:38:27
它看起来像是在数组中使用‘and“,这可能会导致问题
$this->Form->input('gametypes', array(
'label' => 'Type(s) de jeu:',
'option' => $types,
'multiple' => 'checkbox'));这对我来说很好。
https://stackoverflow.com/questions/26052786
复制相似问题