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.

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,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Hey Richard,

Just use

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

On Mon, Nov 1, 2010 at 6:15 PM, Creative Technologist <
[email protected]> wrote:

Doesn’t work at all, the form however picks up the right style when I
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to

[email protected][email protected]

.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

  • Adão Raul