我有以下形式声明:CakePHP的 - 表单助手不输出形式标签
<div class="edit-dialog span-10" style="display:none;">
<div class="edit-message span-10" style="margin-bottom:30px;">
<span>Editing: <a style="text-decoration:none"></a></span>
</div>
<?php
echo $this->Form->create('Voicenote', array('action' => 'edit'));
echo $this->Form->input('title', array(
'div' => false,
'class' => 'input-text recorder',
'label' => array(
'class' => 'inlined',
'text' => ''
),
'id' => 'VoicenoteEditTitle',
'placeholder' => 'Title',
'style' => 'margin-bottom:10px;',
'onsubmit' => 'return false;'
));
echo $this->Form->input('tags', array(
'div' => false,
'class' => 'input-text recorder',
'id' => 'VoicenoteEditTags',
'label' => false,
'placeholder' => 'Tags',
'onsubmit' => 'return false;'
));
echo $this->Form->button('Cancel', array(
'class' => 'button medium blue',
'id' => 'cancel-edit',
'style' => 'float:left;margin-top:50px;'
));
echo $this->Form->submit('Save', array(
'class' => 'button medium blue',
'id' => 'save-edit',
'style' => 'float:right;margin-top:50px;'
));
?>
<input type="hidden" id="edit-container-index" value="">
</div>
它不输出<form></form>
标签和我宣布我的形式这样在我的应用程序,添加$this->Form->end()
也不管用,任何线索?
编辑:明确声明<form></form>
标签不输出他们要么
编辑2:有一些很奇怪我注意到。我在页面上有4个问题,如果我删除了带有问题的元素的渲染,我的另一个表单不会呈现,而是其后的一个。
表单助手是否被添加到控制器中的var $ helpers中?尝试在app/config/core.php中打开调试 – jimiyash
是的,调试输出没有问题,我在同一视图中以相同的方式声明了其他元素,并且在我的布局中,它们都可以工作, 't – 8vius
在这一点上,我们确实需要查看整个页面以确定哪里出了问题。您发布的代码在放入新模板时行为正常;有一些外部因素会扰乱你的代码。 –