Topic: Form Helper Field Size


Using a form_for (form with associated model) I am having trouble setting the size of text_area and text_field.

If this is due to the form helper deriving the form field sizes from the data constraints in the db, does anyone know if there is a workaround for this? At least at the visual level of the form presentation (html or css).

I've tried attributes which are working with form_tag like

  <%= form.text_field :name, :size => 40  %>


<%= form.text_area :message, :size => "30x3" %>

but neither of these are working.


Re: Form Helper Field Size

The text_field should be OK from what I can see, but for the textarea try using :cols =>30, :rows => 3 instead of :size

Are you sure you haven't specified some CSS width/heights for form fields elsewhere in the page that could interfere?

Re: Form Helper Field Size

thanks, this worked.