【发布时间】:2018-03-29 13:59:50
【问题描述】:
自从我在此表单中添加了活动复选框后,我的行为一直很奇怪,提交按钮只能在文本之外单击,并且在提交表单时活动字段的选中状态未注册,它总是显示为真。我检查了 active 是否是保留字,因为这种行为非常时髦,但无济于事。我是菜鸟吗?
<div class="add-form">
<?= $this->Form->create($member) ?>
<legend><?= __('Edit Member') ?></legend>
<?php
echo $this->Form->control('membership_no');
echo $this->Form->control('password');
echo $this->Form->control('email');
echo $this->Form->control('company_id', ['options' => $companies]);
echo $this->Form->control('terms_agreed');
echo $this->Form->control('change_password');
echo $this->Form->control('active');
?>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
如果这里有任何导入是我添加活动列的迁移
<?php
use Migrations\AbstractMigration;
class AddActiveToMembers extends AbstractMigration
{
public function change()
{
$table = $this->table('members');
$table->addColumn('active', 'boolean', [
'default' => true,
'null' => false,
]);
$table->update();
}
}
【问题讨论】:
标签: php forms cakephp cakephp-3.0