Rails - 如何在 f.submit 上放置确认弹出窗口? [英] Rails - How to put a confirmation popup on a f.submit?

查看:28
本文介绍了Rails - 如何在 f.submit 上放置确认弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在新对象表单上的 <% f.submit %> 调用上有一个确认弹出窗口.有没有办法在没有 javascript 的情况下做到这一点?

I want to have a confirmation popup on a <% f.submit %> call on a new object form. Is there a way to do this without javascript?

推荐答案

你想要 <%= f.submit :confirm =>'您的确认消息'%>.仅供参考,这只是 javascript 调用的简写.

You want <%= f.submit :confirm => 'Your confirm message' %>. Just FYI, this is just the short hand for the javascript call.

如其他答案所述,弹出确认的新方法是:

As stated in other answers, the new way to have a popup confirm is:

<%= f.submit 'Save', data: { confirm: 'Your confirm message' } %>

这篇关于Rails - 如何在 f.submit 上放置确认弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆