Add a class attribut into a form_tag

Hi, do you know how to add into this balise a class attribut:

<% form_tag :action => ‘search’ do -%>

in order to doing this in HTML:

Thanks :slight_smile:

Le 15 juin 2008 18:20, Zangief I. a écrit :

Hi, do you know how to add into this balise a class attribut:

<% form_tag :action => ‘search’ do -%>

in order to doing this in HTML:

Regarde le prototype de form_tag [1] :

form_tag(url_for_options = {}, options = {}, *parameters_for_url,
&block)

Tu peux passer 2 hashs en arguments de #form_tag,
l’un pour spécifier l’url, l’autre pour tes options HTML.

– Jean-François.

[1] :
http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html#M001036


http://twitter.com/underflow_

Jean-François Trân wrote:

form_tag(url_for_options = {}, options = {}, *parameters_for_url,
&block)

Tu peux passer 2 hashs en arguments de #form_tag,
l’un pour sp�cifier l’url, l’autre pour tes options HTML.

Hum, je dois être un peu bête, car j’y arrive pas O.o

J’ai tenté ça: <% form_tag {:action => ‘search’}, {:class => ‘sub’} %>
Mais ça donne une “SyntaxError” :s

Tu ouiblies de mettre html et url pour tes hashs.

Thomas.

---- Envoyé avec BlackBerry® d’Orange ----

Le 15 juin 2008 19:18, Zangief I. a écrit :

form_tag(url_for_options = {}, options = {}, *parameters_for_url,
&block)

Tu peux passer 2 hashs en arguments de #form_tag,
l’un pour spécifier l’url, l’autre pour tes options HTML.

Hum, je dois être un peu bête, car j’y arrive pas O.o

J’ai tenté ça: <% form_tag {:action => ‘search’}, {:class => ‘sub’} %>
Mais ça donne une “SyntaxError” :s

Utilise des parenthèses. Si tu ne passes pas de bloc à form_tag,
il faut utiliser <%= %> je crois bien.

<%= form_tag({:action => ‘search’}, {:class => ‘sub’}) %>

ou

<%= form_tag({:action => ‘search’}, :class => ‘sub’) %>

-- Jean-François.


http://twitter.com/underflow_

Merci! :slight_smile:

Le 15 juin 2008 20:26, Thomas Galibert a écrit :

Tu ouiblies de mettre html et url pour tes hashs.

Sauf qu’ici, il utilise form_tag et non form_for.

– Jean-François.


http://twitter.com/underflow_