【问题标题】:disable_with not working in Rails 4.2.6disable_with 在 Rails 4.2.6 中不起作用
【发布时间】:2016-07-20 06:22:40
【问题描述】:

我使用 disable_with 作为提交按钮,它在 Rails 3.2 中工作正常,但在 Rails 4.2.6 中不工作。 这是我使用 disable_with 的表单:

<%= semantic_form_for(@account, :url => account_create_path, :html => { :multipart => true, :class => 'acc_create'}) do |f| %>
  <%= u.input :name, :input_html => {:placeholder => "Name", :value => @account.user.name} %>
  <%= u.input :email, :input_html => {:placeholder => "Email", :value => @account.user.email} %>
  <%= f.buttons do %>
    <%= f.commit_button :label => 'Create My Account', :button_html => {:class => 'register  button', :disable_with => 'Wait...', :id => 'user_submit'} %>
  <% end %>
<% end %>

请帮忙。

【问题讨论】:

    标签: ruby-on-rails formtastic


    【解决方案1】:

    请试试这个:

    <%= f.commit_button :label => 'Create My Account', :button_html => {:class => 'register  button', 'data-disable-with' => 'Wait...', :id => 'user_submit'} %>
    

    【讨论】:

      【解决方案2】:
      <%= f.submit 'Start Your Membership', :class => 'button', :data => {:disable_with => 'Please Wait...'} %>
      

      您还需要将 jquery 和 jquery-ujs javascripts 添加到您的应用程序中。

      【讨论】:

        【解决方案3】:

        这对你有用

        <%= f.commit_button "Create", :button_html => {:class => "btn primary", :disable_with => 'Processing...'} %>
        

        【讨论】:

          【解决方案4】:

          这不是默认的表单生成器。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2016-07-23
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2017-03-19
            • 1970-01-01
            相关资源
            最近更新 更多