How do I submit a text field and return to a new page?

Hello,

I know what I am trying to do is pretty basic but for a newbie like me everything is very daunting right now. Please help me.

The scenario I am trying to program is this. The user enters a string in the search textfield. I will use his entered value to query the database for a matched record and then display the attributes of the fetched record. That is it.

Here is my controller that hopefully on submission from the UI will retrieve the data ===in controller route_controller.rb==== def display_route s = params[‘route’][‘name’] @searched_route = Route.find_by_name(s)
end

Hej Vijay,

You can find some pretty good info about your problem on the Rails API site: http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M000607

This will explain the syntax of the form_tag. I would stick with the default settings (namely POST as the request verb) and just go ahead (would look something like <% form_tag '/your_controller/ display_route' do %>

You can also find some tutorials for beginners on the web or buy a book (pdf).

Hope that helps, Christoph

Vijay Rao wrote: