同一视图上的Active Merchant和f.submit按钮

时间:2014-08-29 14:59:29

标签: ruby-on-rails ruby-on-rails-3.2 activemerchant

我有活跃的商家,我使用简单的形式。

有没有办法可以提交表单并同时提交simple_form数据?

示例:

  <%= simple_form_for @billing, url: checkout_shopping_cart_path do |f| %>

    <h3>Billing & Registration Details</h3>
        <hr>          
        <div class="row">
         <div class="col-md-6">
          <div class="form-group">
           <label for="inputFirstName" class="control-label">Title:</label>
             <div>
               <%= f.input :title, collection: [ 'Mr', 'Mrs', 'Ms' ], selected: 'Mr', label: false %>
             </div>
          </div>
         </div>
         <%= f.submit 'Submit', class: 'btn btn-default-1' %>
         <% end %>
        </div>

  <% payment_service_for @order.reference_id, 'XXXXXXXXXXXX',
    :amount => @order.total*100.round,
    :currency => 'SGD',
    :credential2 => 'xxxxxxxxxx',
    :service => :ipay88 do |service| %>

    <% service.customer :first_name => @user.account.first_name,
                      :last_name => @user.account.last_name,
                      :email => @user.email,
                      :phone => @user.phone %>


    <% @shopping_cart.shopping_cart_items.each do |shopping| %>
      <% service.description shopping.item.name %>
    <% end %>

    <% service.return_url url_for(:only_path => false,
          :controller => 'pay', :action => 'return') %>

   <%= submit_tag "Pay", class: 'btn-default-1' %>
  <% end %>

我的结果是有两个按钮。我如何在一个页面上完成所有操作?

0 个答案:

没有答案