【问题标题】:semantic_form_for with an alert upon completionsemantic_form_for 完成时发出警报
【发布时间】:2011-12-07 06:57:24
【问题描述】:

我正在使用semantic_form_for,我想知道是否有这样的属性:完成然后在成功创建后,表单会提醒一些东西,以便用户必须点击“确定”才能继续?

【问题讨论】:

    标签: ruby formtastic


    【解决方案1】:

    你的意思是提交前确认吗?

    你可以使用类似下面的东西:

    <%= semantic_form_for @user do |f| %>
        ...
        <%= f.buttons do %>
          <%= f.commit_button :button_html => {:confirm => 'Are you sure?'} %>
        <% end %>
    <% end %>
    

    【讨论】:

      【解决方案2】:

      我的解决方案如下,效果很好:

      <%= semantic_form_for @post do |f| %>
        ...
        <%= f.action :submit, :button_html => { 'data-confirm'.to_sym => 'Are you sure?' } %>
      <% end %>
      

      【讨论】:

        猜你喜欢
        • 2013-05-10
        • 1970-01-01
        • 2012-08-17
        • 1970-01-01
        • 2015-03-31
        • 2015-12-10
        • 2022-01-14
        • 2017-08-06
        • 1970-01-01
        相关资源
        最近更新 更多