2014-02-14 32 views
0

有沒有人知道爲什麼會發生這種情況?CakePHP在確認對話框中返回[object object]

我下面的代碼:由蛋糕生成

echo $this->Form->postLink('Excluir', array('action' => 'apagar', $credenciamento['Credenciamento']['id']), array('class' => 'linkbtn') ,array('confirm' => 'Deseja excluir este credenciamento?')); 

代碼:

<a href="#" class="linkbtn" onclick="if (confirm({"confirm":"Deseja excluir este credenciamento?"})) { document.post_52fdf00c73775579079346.submit(); } event.returnValue = false; return false;">Excluir</a> 

當我嘗試通過此鏈接,刪除任何記錄,他的作品,但在對話框中返回的消息只是:

[object object]

確定按鈕和取消按鈕

我也在這個項目中使用了jquery,但是我的腳本生成的對話框正確返回。

+0

你確定代碼給出的結果? 'onclick =「if(confirm({」'應該拋出一個錯誤,因爲JavaScript被第二個'''截斷了。 – Quentin

+0

'confirm()'需要一個純字符串。 –

+0

通過google chrome複製爲HTML ... 'Excluir' –

回答

1

我找到了答案:

echo $this->Form->postLink('Excluir credenciamento', array('action' => 'apagar', $credenciamento['Credenciamento']['id']), array('confirm' => 'Deseja excluir este credenciamento?','class' => 'linkbtn')); 

的陣列參數的順序...

相關問題