0

我无法设置表单的 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>
4

1 回答 1

-1
    <?php echo $this->Form->postLink('Confirm', array('controller' => 'assets', 'action' => 'delete', $yourId), null, __('Are you sure you want to delete # %s?', $yourId)); ?>
于 2014-06-26T14:07:05.830 回答