[英]Rails 3: submit_tag does not :confirm (while link_to does)
Why does this correctly launch the "confirm" dialog... 为什么这会正确启动“确认”对话框...
<%= link_to "Visit Other Site", "http://www.rubyonrails.org/", :confirm => "Are you sure?" %>
...but not this one: ...但不是这个:
<%= submit_tag "Save", :confirm => "Are you sure?" %>
I'm using: 我正在使用:
The :confirm
option is deprecated, it is now going to be replaced by the data attribute. :confirm
选项已被弃用,现在将由data属性代替。 Internally, the submit_tag
is already doing the replacement. 在内部,
submit_tag
已经在进行替换。
See the submit_tag
documentation and source code . 请参阅
submit_tag
文档和源代码 。
Because the data attributes rely on Unobtrusive JavaScript to be executed, you should have included jQuery JS and the Rails UJS file. 因为数据属性依赖于非侵入式JavaScript来执行,所以您应该包括jQuery JS和Rails UJS文件。 Otherwise, the attribute will be visible in the source code (please check it) but will not trigger the confirmation.
否则,该属性将在源代码中可见(请检查该属性),但不会触发确认。
这是一个悬而未决的问题/错误,请参见上面的评论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.