Link_to参数发送表单

时间:2014-11-08 00:42:53

标签: forms ruby-on-rails-4 link-to

我有一个列出子代理列表的页面,如果用户按link_to链接,它将发送到另一个页面,这是形式,因此用户可以为子代理创建货币交易

问题是我必须在用户按下提交之前刷新具有表单的页面, 如果我没有刷新页面,按下提交按钮它没有做任何事情

下面是subagent链接,因为我正在使用bootstrap,下一页有ransack参数

        <%= link_to '<i class="glyphicon glyphicon-transfer"></i>'.html_safe, new_paymentformandira_path( :q => {"id_subagent_eq"=>subagent.id_subagent} ) , :class => 'btn btn-mini btn-info' %>

以下是我发送之前必须刷新的表单 它有3个部分(因为它是部分的)

            <%= form_tag create_payment_paymentformandiras_path, :method => :put do %>
                <% @receivablelists.each do |receivablelist|  %>
                     <tr class="row-detail">
                        <% if receivablelist.booking_date %>
                            <td><%= receivablelist.booking_date.strftime("%e %B %Y") %></td>
                        <% else  %>
                            <td></td>
                        <% end  %>
                        <td><%= link_to receivablelist.guest_name, edit_booking_path(receivablelist.id) %></td>
                        <td><%= receivablelist.city %></td>
                        <td><%= receivablelist.hotel_name %></td>
                        <td><%= receivablelist.sub_agent %></td>
                        <td><%= receivablelist.invoice_mandira %></td>
                        <td class="text-right"> <%= number_with_precision(receivablelist.total_pay_debt_count , precision: 2, separator: '.', delimiter: ',') %></td>


                        <td><%= check_box_tag 'include_payment[]', position,false, class: "transfer-include" %>  </td>
                        <% position = position + 1 %>

                        <td><%= text_field_tag 'text_payment_amount[]', receivablelist.total_pay_debt_count, class: 'transfer-amount right-align' %></td>
                        <%= hidden_field_tag 'text_id[]', receivablelist.id %>
                    </tr>
                <% end  %>
                <h3 class="text-info">Payment</h3>
                <div class="row">
                    <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
                        <p>Transfer Date</p>
                        <p>Destination Bank Name</p>
                        <p>Notes</p>
                        <p>Total Deposit / transfer</p>
                        <p>Total pay</p>
                    </div>
                    <div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
                        : <%= text_field 'text_transfer_date',"", :class => :datepicker %> <br>
                        : <%= text_field 'text_bank_name',"" %> <br> 
                        : <%= text_field 'text_notes',"" %> <br>
                        : <%= text_field 'text_total_deposit', nil, class: "text-right" %><br>
                        : <%= text_field_tag 'text_total_amount', nil,  class: "total-transfer-amount text-right text-muted", disabled: true, size: 12 %><br>
                    </div>
                </div>
                <%= submit_tag "Do Payment" %>

谢谢

1 个答案:

答案 0 :(得分:0)

我刚刚解决了上面的问题,引自此链接Submit button does not work unless I refresh the page form_for Rails

表和表单标记之间的标记不匹配

希望它可以帮助别人