I am trying to create something like this as i have done it in one of my admin views:
<td class="actions">
<form action="/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>
Using this:
<?php
echo $this->Form->postLink(__('Delete'), array(
'action' => 'delete',
$user['User']['id']),
null,
__('Are you sure you want to delete # %s?', $user['User']['id']));
?>
I am trying it with the same code in another view and i dont know why i only get this:
<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>
Why is this happening if i am using the exact same code to generate it? Thanks.
You haven't created the form itself so essentially you are using input fields without a form.
echo $this->Form->create();