0

I am unable to set the id of the form or the class of the submit button. I seen examples that follow my code but I am not getting either set.

I am using cakePHP 2.5.

<?php
  echo $this->Form->postLink(
       'Confirm',
          array('controller' => 'assets', 'action' => 'delete'),
          array('id' => 'testId', 'class' => 'btn btn-confirm')
      );
?>

What I get is

<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>
Keith Power
  • 13,891
  • 22
  • 66
  • 135
  • Manipulating the form isn't supported, look at the source, the options are hard-coded. Defining `id` or `class` attributes for the link however does work fine (just tested against 2.5.2), maybe you are experiencing a bug in an "older" 2.5.x release, maybe you have overwritten affected Helper logic somewhere, who knows, could be anything... ps. please always mention your _exact_ CakePHP version! – ndm Jun 26 '14 at 14:04

1 Answers1

-1
    <?php echo $this->Form->postLink('Confirm', array('controller' => 'assets', 'action' => 'delete', $yourId), null, __('Are you sure you want to delete # %s?', $yourId)); ?>
chetanspeed511987
  • 1,995
  • 2
  • 22
  • 34
  • @chetanspeed511987 Is your provided example supposed to work magically since neither id or css class are being passed to the method? – ADmad Jun 26 '14 at 17:20