Currently I have a registration form that is built like this:
First name
<%= text_field “user”, “first_name” %>
Last name
<%= text_field “user”, “last_name” %>
Email
<%= text_field “user”, “email” %>
User type
<%= text_field “user”, “type” %>
Password
<%= text_field “user”, “password” %>
My question is can I create a style named “text_field”, it didn’t seem
to work for me.
In other words what would be the best way to style the input boxes. I
guess it seems at this point text_field is a proprietary to rails ?
My question is can I create a style named “text_field”, it didn’t seem
to work for me.
In other words what would be the best way to style the input boxes.
I think you mean you want to create a class called text_field, so you
can use CSS to style your boxes, correct?
I’m not sure if I understand what you want. If you do
<%= text_field :user, :first_name %>
this will generate
I recommend you create a helper like this:
def labeled_text_field(name, obj, meth, options ={})
“<label for="#{obj}_#{meth}">#{name}” +
text_field obj, meth, options
end
and your example can be written like this:
<%= labeled_text_field “First name”, :user, :first_name %>