Issue
When I add the class array to the postLink, the confirm alert stops working. I have moved the class array into different positions but within the postLink but nothing seems to work.
<?= $this->Form->postLink(__('Delete'),
['controller' => '<%= $details['controller'] %>', 'action' => 'delete', <%= $otherPk %>],
['class' => 'btn btn-danger btn-sm'],
['confirm' => __('Are you sure you want to delete # {0}?', <%= $otherPk %>)]) %>
The above code will add the right classes to the link, but the confirmation doesn't work, it just deletes the entry right away.
Solution
the confirm
message and the other html options like class
go in the same array
<?= $this->Form->postLink(__('Delete'),
['controller' => '<%= $details['controller'] %>', 'action' => 'delete', <%= $otherPk %>],
['class' => 'btn btn-danger btn-sm'],'confirm' => __('Are you sure you want to delete # {0}?', <%= $otherPk %>)]) %>
Answered By - arilia
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.