Paul Meier
Paul Meier

Reputation: 117

Rails form submit to new page

If I have a form taking a collection of names, a date, and another boolean via virtual attributes how can I submit them to a new page and action. That has nothing to do with CRUD. It will simply do some processing then spit out the values on a new page.

personsSelection.erb

<%= render :partial => 'myForm' %>

_myForm.html

<%= simple_form_for(@person) do |f| %>
<%= f.input :names, :collection => People.all, as => :check_boxes %>
<%= f.input :DateTime %>
<%= f.check_box :paid %>
<%= f.submit %>

person_controller.erb

def personReport
  #Some Random Processing
end

personReport.html.erb

#Display the personReport processing data

Again, I'm trying to submit the form to process via personReport action then display to a new page called personReport.html.erb

Upvotes: 0

Views: 591

Answers (1)

Kyle C
Kyle C

Reputation: 4097

In your routes

  match "/person/personreport" => "person#personReport", :as => personreport

In your form

  <%= simple_form_for(@person, :url => personreport_path) do |f| %>

This will send the data to your personReport action where you can process the data then by default that action will render personReport.html.erb

Upvotes: 1

Related Questions