0

我的查看代码是

<%= form_for(@payment,:url => verify_payment_payment_index_path) do |f| %>
  <%= f.radio_button("amount", "10") %>
  <%= label :amount, '10 Rs',:style => "display:inline" %> <br>
  <%= f.radio_button("amount", "20") %>
  <%= label :amount, '20 rs',:style => "display:inline" %><br>
  <%= f.radio_button("amount", "50") %>
  <%= label :amount, '50 rs',:style => "display:inline" %><br>
  <%= f.radio_button :amount, '100' %> 
  <%= label :amount, '100 rs',:style => "display:inline" %><br>    
  <%= link_to "Make Payment", verify_payment_payment_index_url, 
              :class => "btn",
              :data => { :toggle => "modal",
                         "target" => "#myBox" },
              "for"=>"Make Payment" %>

<% end %>

在单击链接“付款”后,我想在控制器操作中访问参数中的所有值。那么我怎样才能在 Rails 3 中实现它呢?请注意,我必须在点击链接时打开灯箱,然后提交表单

4

1 回答 1

1

您需要提交表格!所以尝试以下方法:

<%= form_for(@payment,:url => verify_payment_payment_index_path) do |f| %>
   <%= f.radio_button("amount", "10") %>
   <%= label :amount, '10 Rs',:style => "display:inline" %> <br>
   <%= f.radio_button("amount", "20") %>
   <%= label :amount, '20 rs',:style => "display:inline" %><br>
   <%= f.radio_button("amount", "50") %>
   <%= label :amount, '50 rs',:style => "display:inline" %><br>
   <%= f.radio_button :amount, '100' %> 
   <%= label :amount, '100 rs',:style => "display:inline" %><br>

   <%= f.submit "Make Payment", :class=>"btn",:data => {:toggle => "modal","target"=>"#myBox"},"for"=>"Make Payment" %>

<% end %>
于 2013-07-05T19:46:18.920 回答