我有以下形式聲明: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
在這一點上,我們確實需要查看整個頁面以確定哪裏出了問題。您發佈的代碼在放入新模板時行爲正常;有一些外部因素會擾亂你的代碼。 –