I have problem with Cake PHP delete javascript confirmation dialog.
I am using this code:
<td><?php echo $this->Html->link('Delete',
array('controller' => 'RealEstate', 'action' => 'delete',$r['RealEstate']['id']),
array('onclick'=>'return confirm(\"Are you sure?\");'))?> </td>
and this produce html:
<td><a onclick='return confirm(\"Are you sure?\");' href="/cake1/RealEstate/delete/65">Delete</a> </td>
as you can see this produce wrong Html.
How to fix this ?
FIXED: Problem was in back slashes \\"Are you sure?\\", just removed \\ and this works well "Are you sure?"
try this
echo $this->Form->postLink(__('Delete'), array(
'controller'=>'RealEstate',
'action' => 'delete',
$r['RealEstate']['id']),
null,
__('Are you sure you want to delete # %s?',
$r['RealEstate']['id'])
);
Try this
<?php
echo $this->Html->link('',array('controller'=>'Mycont','action'=>'deletepic',$id),
array('confirm'=>'Are you sure you want to delete the image?'));
?>
修正:问题出在反斜杠“您确定吗?”,刚删除了\\,就可以正常工作了“您确定吗?”
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.