Rails提交按钮不使用它上面的类

时间:2017-10-14 02:29:32

标签: ruby-on-rails materialize

简单Rails在Modal中形成。

工作:     <%= submit_tag "New Form", :class => "waves-button-input" %>

工作:

<%= submit_tag "New Form", :class => "waves-effect waves-green btn-flat waves-button-input" %>

我已尝试通过<input>代码,提交代码,表单提交POST等进行此操作。由于某些原因,添加这些类会破坏它。

完整背景我的表格:

<div id="projectModal" class="modal">
  <div class="modal-content">
    <div class="form-group">
    <%= form_tag(new_project_path, method: :get) %>
        <%= select_tag :project_type, options_for_select(Project.project_types.keys.to_a), :class => 'id_select', :id => 'secret_id'  %><br><br><br>
        <%#= text_field :client_id, %>
        <%= collection_select :project, :client_id, current_user.clients, :id, :name, :prompt => true %>

    </div>
  </div>
  <div class="modal-footer">
    <a class="modal-action modal-close waves-effect waves-green btn-flat modal-close">Cancel</a>
    <%= submit_tag "New Form", :class => "waves-button-input" %>

    <!--<input type="submit" name="commit" value="New Form" class="waves-effect waves-green btn-flat waves-button-input" data-disable-with="New Form">-->
    <!--<input type="submit" name="commit" value="New Form" class="waves-button-input" data-disable-with="New Form">-->
  </div>
</div>

单击全部它会将<i>更改为颜色和完整效果,但会努力发送数据。通常情况下,我会想到turbolinks或者其他东西,但是因为它没有风格化而工作,我很困惑。

1 个答案:

答案 0 :(得分:1)

尝试将ID添加到表单并提交标记

= form_tag(new_project_path, method: :get, id: 'formId')

= submit_tag "New Form", :class => "waves-effect waves-green btn-flat waves-button-input", form: 'formId'