# Accessing values of the form

**URL:** <https://www.ruby-forum.com/t/accessing-values-of-the-form/110745>\
**Category:** Rails\
**Created:** [July 30, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/accessing-values-of-the-form/110745 "2007-07-30T16:02:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![capi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbce88/32.png) [@capi](https://www.ruby-forum.com/u/capi)\
**Post date:** [July 30, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/accessing-values-of-the-form/110745/1 "2007-07-30T16:02:58Z")

</div>

Hello.  
Im new on rails, and i’m trying to make a page that will invoque a  
webservice.  
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 %\>

| Tipo entidade | \<%= select( "pesquisa", "value", { "Empresa" =\> "0", "Individual" =\> "1", "Desconhecido"=\>"2"}) %\> |
| Lingua | \<%= select :pesquisa, :language, @SiteLanguages, {:selected=\>@selected\_language} %\> |
| Nome | \<%= text\_field :pesquisa, :nome, :maxLength =\> 70, :size =\> 70 %\> |
| NIF | \<%= text\_field :pesquisa, :nif, :maxLength=\>9, :size=\>9 %\> |
| Telefone | \<%= text\_field :pesquisa, :telefone, :maxLength =\> 15, :size= =\>15 %\> |
| Num. Coface | \<%= text\_field :pesquisa, :numCoface, :maxLength=\>8, :size=\>8 %\> |
| Distrito | \<%= select :pesquisa, :distrito, @Distritos, {:selected=\> @selected\_distrito} %\> |
| Concelho | \<%= text\_field :pesquisa, :concelho %\> |
| Codigo postal | \<%= 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 = Time.now

```
@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’,  
‘Funchal’]  
@selected\_distrito = ‘Braganca’  
end

def mostra

```
 if request.post?
  @time = Time.now
  @parametro = 12
  #redirect_to :action => 'pesquisa'
 end

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

```

end

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,  
Capi

---

<div class="post-metadata">

**Author:** ![capi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbce88/32.png) [@capi](https://www.ruby-forum.com/u/capi)\
**Post date:** [July 31, 2007, 4:56am UTC](https://www.ruby-forum.com/t/accessing-values-of-the-form/110745/2 "2007-07-31T04:56:25Z")

</div>

in the params hash

e.g.  
text\_field :foo, :bar == params[:foo][:bar]

On Jul 30, 10:02 am, Antonio Fernandes \<rails-mailing-l…@andreas-
