我想創建這樣的事情,因爲我已經在我的管理視圖中的一個做它:HTML的幫助postLink CakePHP中
<td class="actions">
<form action="https://stackoverflow.com/users/delete/26" name="post_4f7825317b6b0" id="post_4f7825317b6b0" style="display:none;" method="post">
<input type="hidden" name="_method" value="POST">
</form>
<a href="#" onclick="if (confirm('Are you sure you want to delete # 26?')) { document.post_4f7825317b6b0.submit(); } event.returnValue = false; return false;">
Delete
</a>
</td>
使用此:
<?php
echo $this->Form->postLink(__('Delete'), array(
'action' => 'delete',
$user['User']['id']),
null,
__('Are you sure you want to delete # %s?', $user['User']['id']));
?>
我想它在另一種觀點相同的代碼,我不知道爲什麼我只得到這樣的:
<input type="hidden" name="_method" value="POST">
<a href="#" onclick="if (confirm('Are you sure you want to delete # %s?')) { document.post_4f782a44e9784.submit(); } event.returnValue = false; return false;">
Delete
</a>
這究竟是爲什麼,如果我使用的是完全相同的合作德生成它? 謝謝。
您確定設置了$ user變量並且包含您認爲它的用途嗎? – JJJ 2012-04-01 11:02:36
是的,我相信它。 – Alvaro 2012-04-01 19:48:32