form_for .label class

Hi,

Could anyone tell me what I'm doing wrong below when trying to apply a style to the following label and text field

    <div class="group">     <%= f.label :name, :html => {:class => "label"} %>       <%= f.text_field :name, :html => {:class => "label"} %>     </div>

Doesn't work at all, the form however picks up the right style when I use this code ...

<% form_for [:admin, @organisation], :html => {:class => "form"} do | f> %>

Thanks in advance!

Richie.

Hey Richard,

Just use

<%= f.text_field :name, :class => “label” %>

Creative Technologist wrote in post #958582:

Hi,

Could anyone tell me what I'm doing wrong below when trying to apply a style to the following label and text field

    <div class="group">     <%= f.label :name, :html => {:class => "label"} %>       <%= f.text_field :name, :html => {:class => "label"} %>     </div>

Read the docs for the label method again, and follow the syntax there. You're not specifying the options hash like it expects.

Best,