Problem with submit button

Hi,

I wanted to create some static pages using rails and used rails g controller Staticpages main movie song book Which has created a controller file "static_pages_controller.erb" and view files under /views/static_pages/main.html.erb etc

I have created a form using form_for on my main page which has a drop down menu for selecting one of "movie, song, book" and a submit button using <%= form_for :mode do |f| %>       <div class="field">         <%= f.label :mode %><br />         <%= f.select :mode, ['Please select one', 'Movie', 'Book', 'Song'] %>       </div>       <div class="actions">         <%= f.submit "Submit" %>       </div>     <% end %>

My controller file looks like this class StaticPagesController < ApplicationController   def main

  end   def movie   end   ... end

A click on submit on my main page generates 'No route matches POST "/static_pages/main" . Do i have to create a func for post? If so since the static pages class is same for the remaining movie,book, song how do i handle submits from other pages?

Also how do i retrieve the values of form_for in the controller?

routes.rb have only these

get "staticpages/main" get "staticpages/movie" get "staticpages/book"

How do i add a route to post method?

I can specify the controller using :url => {:action => 'XYZ'} But since I don't have ( nor need) a model file for the form , so what should i write here "?" <%= form_for (?) do |f| %>

u need to do this form_for(:mode, :url => {:action => “action_name”, :controller => “controller_name”})

and in the routes file, u need to add

post “static_pages/main” “contoller_name#action_name”

If you have not got an object to populate the form then you can use form_tag instead.

Colin