首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FormHelper奇异输入CakePhp

FormHelper奇异输入CakePhp
EN

Stack Overflow用户
提问于 2014-09-26 05:42:31
回答 1查看 59关注 0票数 0

我遇到了FormHelper的麻烦。

我有我的第一个模型“游戏”。看起来是这样的:

代码语言:javascript
复制
 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');
 }

当我尝试使用该代码在复选框中添加“游戏类型”时:

代码语言:javascript
复制
    <?= $this->Form->input('gametypes', array("label" => "Type(s) de jeu:", 'option' => $types, 'multiple' => 'checkbox')); ?>

这是一个文本表单而不是复选框..。

我真的不明白。这是唯一不能用的东西。所有其他模型(作者,编辑.)不仅是对的..。我检查了所有的代码很多次了。和其他模特一样..。

如果需要的话,我可以发布更多的信息(var_dump,调试,任何东西!)

如果有人有主意..。请!

谢谢各位

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-09-26 20:38:27

它看起来像是在数组中使用‘and“,这可能会导致问题

代码语言:javascript
复制
$this->Form->input('gametypes', array(
    'label' => 'Type(s) de jeu:',
    'option' => $types,
    'multiple' => 'checkbox'));

这对我来说很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26052786

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档