我有问题的蛋糕PHP删除javascript确认对话框。
我正在使用这个代码:
<td><?php echo $this->Html->link('Delete',
array('controller' => 'RealEstate', 'action' => 'delete',$r['RealEstate']['id']),
array('onclick'=>'return confirm('"Are you sure?'");'))?> </td>
生成html:
<td><a onclick='return confirm('"Are you sure?'");' href="/cake1/RealEstate/delete/65">Delete</a> </td>
如你所见,这会产生错误的Html。
如何解决这个问题?
固定:问题出在后面的斜杠上"你确定吗?",刚刚删除,这工作得很好"你确定吗?"
试试这个
<?php
echo $this->Html->link('',array('controller'=>'Mycont','action'=>'deletepic',$id),
array('confirm'=>'Are you sure you want to delete the image?'));
?>
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'])
);
修正:问题是在反斜杠'"你确定吗?",刚刚删除,这工作得很好"你确定吗?"