使用表单帮助器和Checkox的cakephp3
我已经创建了一个表单。只要输入字段,一切正常。但现在我使用checkbox作为一种类型,它只发送一个使用表单帮助器和Checkox的cakephp3,cakephp,Cakephp,我已经创建了一个表单。只要输入字段,一切正常。但现在我使用checkbox作为一种类型,它只发送一个0和1,无论我是否选中它 echo $this->Form->input('phone', ['type' => 'checkbox', 'label' => ['text' => __('Telefon/Handy'), 'class' => 'moCheckLabel']]); 也适用于单选按钮,但只有一个空按钮和一个带有0 echo $this->
0
和1
,无论我是否选中它
echo $this->Form->input('phone', ['type' => 'checkbox', 'label' => ['text' => __('Telefon/Handy'), 'class' => 'moCheckLabel']]);
也适用于单选按钮,但只有一个空按钮和一个带有0
echo $this->Form->radio(
'type',
[
['value' => '0', 'text' => __('Move'),],
['value' => '1', 'text' => __('Just'),],
], ['label' => ['class' => 'moCheckLabel']]
);
这对我来说毫无意义,知道吗
编辑:问题一已解决。单选按钮仍然是个谜:/
echo $this->Form->input('phone', ['type' => 'checkbox','hiddenField' => '0', 'label' => ['text' => __('Telefon/Handy'), 'class' => 'moCheckLabel']]);
好的,谢谢,我可能读过头了
echo $this->Form->radio(
'type',
[
['value' => '0', 'text' => __('Move'),],
['value' => '1', 'text' => __('Just'),],
], ['label' => ['class' => 'moCheckLabel'], 'hiddenField' => false]
);
'hiddenField'=>false玩了这个把戏吗你试过这个把戏了吗