我无法设置表单的ID或提交按钮的类。我看到了遵循我的代码的示例,但我没有设置。
我正在使用cakePHP 2.5。
<?php
echo $this->Form->postLink(
'Confirm',
array('controller' => 'assets', 'action' => 'delete'),
array('id' => 'testId', 'class' => 'btn btn-confirm')
);
?>
我得到的是
<form action="/assets/ajax_delete/56.json" name="post_53ac1bb05415c464261170" id="post_53ac1bb05415c464261170" style="display:none;" method="post">
<input type="hidden" name="_method" value="POST">
</form>
<a href="#" onclick="document.post_53ac1bb05415c464261170.submit(); event.returnValue = false; return false;">Confirm</a>
答案 0 :(得分:-1)
<?php echo $this->Form->postLink('Confirm', array('controller' => 'assets', 'action' => 'delete', $yourId), null, __('Are you sure you want to delete # %s?', $yourId)); ?>