2011-10-07 37 views
0

我有以下形式聲明: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個問題,如果我刪除了帶有問題的元素的渲染,我的另一個表單不會呈現,而是其後的一個。

+1

表單助手是否被添加到控制器中的var $ helpers中?嘗試在app/config/core.php中打開調試 – jimiyash

+0

是的,調試輸出沒有問題,我在同一視圖中以相同的方式聲明瞭其他元素,並且在我的佈局中,它們都可以工作, 't – 8vius

+0

在這一點上,我們確實需要查看整個頁面以確定哪裏出了問題。您發佈的代碼在放入新模板時行爲正常;有一些外部因素會擾亂你的代碼。 –

回答

3

你有一個提交按鈕。只需在你的ctp文件中提交按鈕後添加end()即可。

<?php 
echo $this->Form->create('users'); 
echo $this->Form->input('username'); 
echo $this->Form->input('password'); 
echo $this->Form->submit('login'); 
echo $this->Form->end(); 
?> 
+0

也試過這個是不行的,就像我說的甚至明確添加

標籤不起作用 – 8vius

+0

http://dc388.4shared.com/download/7amUwmr5/tsid20111009-212843-57b8d679/ Screenshot-1.png - 我複製你的代碼在ctp文件和窗體創建。請檢查你的蛋糕來源。下載最新的穩定版本。我希望對你有用。 – Chalist

+0

網站上的所有其他表單都以相同的方式正確創建,無論它是特定於此表單的。 – 8vius

0

您好我認爲,如果你最後回聲改變

echo $this->Form->end(array(
    'label'=>'Save', 
    'class' => 'button medium blue', 
    'id' => 'save-edit', 
    'style' => 'float:right;margin-top:50px;' 
)); 

它應該工作

+0

試過這種沒有工作 – 8vius