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 に答える