$html->cakephp 中的链接中的警报框
我知道点击链接时获取确认消息的代码如下所示。
<?php
echo $html->link('Delete',
array('controller'=>'forms','action'=>'delete', $r['Form']['id']),
array(),
'really delete the Form ?',
false
);
?>
通过单击确认消息中的“确定”按钮删除表单后,我需要一个警告框,显示“您的表单已被删除”。
有没有办法获得警告框而不是确认框或确认框后出现警告框?
I know that the code to get a confirm message while clicking on a link is as given below.
<?php
echo $html->link('Delete',
array('controller'=>'forms','action'=>'delete', $r['Form']['id']),
array(),
'really delete the Form ?',
false
);
?>
I need an alert box saying "Your form has been deleted" after deleting the form by clicking on the 'ok' button in the confirm message.
Is there a method to get an alert box instead of the confirm box or an alert box after the confirm box?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了使用 Ajax 助手的答案。 蛋糕书上都有,我只要仔细看一下就可以了。 不使用$html->link,需要使用$ajax->link
以下是获取 html 链接中警报框的代码。
警报框在操作完成后调用,并应在 $ajax->link 数组的“完成”条件中提及。
I found out the answer which uses the Ajax helper. It is all in the cake book, I just need to read it more carefully. Instead of using $html->link,need to use $ajax->link
Here is the code to get the alert box in the html link.
The alert box is called after the action is completed and should be mentioned in the 'complete' condition of the $ajax->link array.
您需要使用 JavaScript 来执行此操作。 将触发单击事件,在该事件中,您将调用“alert("hey!");” 这确实独立于 CakePHP 框架,因为我认为没有 JavaScript 帮助器可以做到这一点。
You'll need to use JavaScript to do this. A click event would fire and in that event, you would call "alert("hey!");" This is really independent of the CakePHP framework, as I don't think there's a JavaScript helper to do that.