如何在模态中创建提交按钮?

时间:2013-06-28 01:51:14

标签: ruby ruby-on-rails-3 haml

我创建了一个普通的

= simple_form_for @nacform, :html => { :multipart => true } do |f|


  = f.error_notification

  .row
    .span12
      %h4 Form Details
      %hr
  .row
    .span3
      .field
        = f.input :Title
      .field
        = f.input :Description
      .field
        = f.label :asset, "File"
        = f.file_field :asset
  .form-actions

    = link_to 'Back', nacforms_path, :class => 'btn btn-small btn-primary'
    %a#modal_btn.btn.btn-success.btn-small{:href => "#modal"} Continue

和模态

#modal.modal.hide
    .about
      .modal-header
        %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} ×
        %h2 Forms
    = simple_form_for @nacform, :html => { :multipart => true } do |f|
      = f.button :submit, "Upload Form", :class => 'btn btn-success'

:javascript
    $("#modal_btn").click(function(){
      $('#modal').modal();
    });

表单的提交按钮在模态上,但是当我点击该提交按钮时没有任何反应,我做错了吗?

1 个答案:

答案 0 :(得分:0)

为了使用jQuery show方法或从中派生的东西来显示内容,通常会指定一个易于覆盖的内联样式:

#modal.modal{ :style => 'display:none' }

拥有.hide CSS类可能会导致它保持隐藏状态。