Disabling escape in FormHelper::postLink() breaks alert confirmation
cakephp, cakephp-2.0, html, php
Solution
Wrong number of arguments
By adding the `escape => false` option, you forgot to remove the placeholder `null` for the third argument. Because of this, you're now passing five arguments.
Remove the `null` and it should work;
echo $this->Form->postLink(
// title
'<i class="icon-trash"></i> Delete',
// URL
array('controller' => 'documents', 'action' => 'delete', $document['id']),
// Options
array('escape' => false),
// confirmMessage
__('Are you sure you want to delete # %s?', $document['file'])
);
See the documentation; `FormHelper::postLink()`
Problem
When I try setting escape to false within a postlink helper, the JavaScript alert seems to break in Chrome, not sure why as I'm not getting any console errors, it just fires the action without an initial alert. ``` echo $this->Form->postLink('<i class="icon-trash"></i> Delete', array('controller' => 'documents', 'action' => 'delete', $document['id']), array('escape' => false), null, __('Are you sure you want to delete # %s?', $document['file']) ); ``` Any suggestions?