I have an .erb file with form template that uses form_for
helper to generate form, and some of their fields generated with text_field
method. In resulting HTML I see size
properties are added to every input generated with aforementioned method.
I want to control input sizes with CSS and that size
property prevents me from doing it. Is there any way to tell text_field
method that I don't want them?
I tried to pass :size => nil
as option to that method, but that didn't help.
This worked for me
<%= f.text_field :title, :size => nil %>
You can use CSS or the :size option to control the size of input fields. I'm not sure if there is an option to remove the size attribute, I've always just ignored it and set the width of input fields with CSS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With