【发布时间】:2015-01-29 11:56:35
【问题描述】:
实际上,这是我从 mysql 数据库中获取值的观点,我根据参数 page=1 page =2 page =3 在浏览器中显示,我想在下一步按钮单击中更改 params[:page]。
基于 pages=1,2,3 问题和答案会有所不同,这就是为什么我需要在同一页面中单击按钮时更改 url。!像下面的 URL http://localhost:3000/responses/new?page=1 在此先感谢。
<%= form_for (@response) do |f| %>
<% @questions.each do |pgquestion| %>
<% if pgquestion.group_id == 0 %>
<%= label :pgquest,pgquestion.description %><br><br>
<% else %>
<%= label :pgquest,pgquestion.description %>
<% (1..pgquestion.question_value.to_i).each do |i| %>
<%= radio_button_tag "ans_value[#{ pgquestion.quest_id }]", i %>
<% end %>
<br><br>
<% if pgquestion.question_type == "textarea" %>
<%= text_area "", "ans_value[#{ pgquestion.quest_id }]" ,size: '80x5' %><br><br>
<% else if pgquestion.question_type == "text" %>
<%= text_field "", "ans_value[#{ pgquestion.quest_id }]" %> <br><br>
<% end %>
<% end %>
<% end %>
<% end %>
<div style="text-align: center">
<%= f.submit 'Prev' ,:class => 'btn btn-primary',:name => "previous_button" %>
<%= f.submit 'Next', :class => 'btn btn-primary' %> <br><br>
<p><%= f.submit "Continue" %></p>
<p><%= f.submit "Back", :name => "previous_button" %></p>
</div>
<% end %>
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-4