admin管理员组文章数量:1306209
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?"
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?"
Share Improve this question edited Aug 29, 2015 at 15:12 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Mar 19, 2014 at 22:59 NezirNezir 6,92512 gold badges57 silver badges84 bronze badges 1- 1 Yeah, no need to escape it there... – skywalker Commented Mar 19, 2014 at 23:24
3 Answers
Reset to default 5Try this
<?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'])
);
FIXED: Problem was in back slashes \"Are you sure?\", just removed \ and this works well "Are you sure?"
本文标签: javascriptCakePHP delete confirmationStack Overflow
版权声明:本文标题:javascript - CakePHP delete confirmation - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741818418a2399218.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论