Forum: Ruby on Rails Accessing values of the form

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Antonio F. (Guest)
on 2007-07-30 18:02
Im new on rails, and i'm trying to make a page that will invoque a
But since im new on rails, i'm trying to make a simple thing, trying to
pass the values of a form to a new page.

I've got this form:

<%= start_form_tag :action => "mostra", :id => @parametro %>
<tr><td>Tipo entidade</td>
<td> <%= select( "pesquisa", "value", { "Empresa" => "0", "Individual"
=> "1", "Desconhecido"=>"2"}) %></td></tr>
<td> <%= select :pesquisa, :language, @SiteLanguages,
{:selected=>@selected_language} %></td></tr>
<td><%= text_field :pesquisa, :nome, :maxLength => 70, :size => 70
<td><%= text_field :pesquisa, :nif, :maxLength=>9, :size=>9
<td><%= text_field :pesquisa, :telefone, :maxLength => 15, :size= =>15
<tr><td>Num. Coface</td>
<td><%= text_field :pesquisa, :numCoface, :maxLength=>8, :size=>8
<td> <%= select :pesquisa, :distrito, @Distritos, {:selected=>
@selected_distrito} %></td></tr>
<td><%= text_field :pesquisa, :concelho  %></td></tr>
<tr><td>Codigo postal</td>
<td><%= text_field :pesquisa, :codPostal, :maxLength=>8, :size=>8
<%= submit_tag 'Pesquisar' %>
<%= end_form_tag %>

ANd this is my controler:
class ClfController < ApplicationController
  def pesquisa
    @time =

    @SiteLanguages = ['en', 'de', 'fr']
    @selected_language = 'en'

    @TipoEntidade = ['Empresa', 'Individual', 'Desconhecido']
    @selected_tipoEntidade = 'Empresa'

    @Distritos = ['Aveiro','Beja', 'Braga', 'Braganca', 'Castelo
Branco', 'Coimbra', 'Évora', 'Faro', 'Guarda', 'Leiria', 'Lisboa',
'Portalegre' , 'Porto' ,'Santarem' ,'Setubal', 'Viana do Castelo', 'Vila
Real' , 'Viseu', 'Angra do Heroismo', 'Horta', 'Ponta Delgada',
    @selected_distrito = 'Braganca'

  def mostra

      @time =
      @parametro = 12
      #redirect_to :action => 'pesquisa'

    #@items = Clf.find(pesquisa[nome])

Can anybody give me a help teling me how do i access in the controller
to the values submited from the form.

Thank you in advance,
Jeff E. (Guest)
on 2007-07-31 06:56
(Received via mailing list)
in the params hash

  text_field :foo, :bar == params[:foo][:bar]

On Jul 30, 10:02 am, Antonio Fernandes <rails-mailing-l...@andreas-
This topic is locked and can not be replied to.