Ruby on Rails学习笔记08

<%= f.submit "Submit", data: {
      disable_with: "Submitting..."} %>
<%= f.submit "Submit02", data: {
      confirm: "Are you sure!" } %>

data: { disable_with: “Submitting…”}:在参数送出时暂时关闭按钮避免重复送出,按钮显示disable_with里的内容

data: { confirm: “Are you sure!” }:参数送出时打开确认提示框,显示确认提示

以下两种写法都可以

<%= f.submit "Submit", data: {
      confirm: "Are you sure!" } %>
<%= f.submit "Submit", data: {
      :confirm => "Are you sure!"} %>

你可能感兴趣的:(Ruby,on,Rails)