class TestController < ApplicationController
def search
if request.post?
criteria = params[:criteria]
@result = "search result of using #{criteria}"
end
end
search.rhtml:
-------------
<%= form_tag :action => "search" %>
<%= text_field_tag "criteria" %>
<%= submit_tag "Search" %>
<%= @result %>
<%= end_form_tag %>
> --- Ursprüngliche Nachricht ---
> Von: Richard Williams <sales-9yA49x/h1pUsV2N9l4h3zg@public.gmane.org>
> An: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> Betreff: [Rails] Simple input form
> Datum: Wed, 26 Oct 2005 12:52:23 -0400
>
> I need a simple search form where you enter the search word and have a
> "search" button.
>
> I''ve looked through the agile book and don''t see an
example of using an
> instance variable and a text field to get a value which is then passed to
> the controller. All of the examples in the book seem to use a model
> instance
> to hold form field values.
>
> Also Is there a reference manual for eRuby out there somewhere?
>
> Richard
>