This project is archived and is in readonly mode.

#5084 ✓resolved

File Field shouldn't include a size attribute

Reported by Dru | July 11th, 2010 @ 12:25 PM | in 3.0.2

In html5 a file input can't have a size attribute otherwise it's invalid. But using the file_field helper gives it a default size of 30:

file_field(:user, :avatar)
# => <input type="file" id="user_avatar" name="user[avatar]" size="30" />

It seems like there's 2 possible places the behaviour could be changed. Either in file_field method by setting size to nil in the default options. Or in the to_input_field_tag method (there's currently a condition for hidden field with unsets the size option).

I realise it's relatively minor (since size can just be set to nil when you call the helper) but since the rails 3 default is html5 it would be nice if the helper generated valid html5 code by default.

Apologies for not providing a patch btw, the system I'm on at the moment isn't setup for any kind of development but I wanted to post this ticket while I remembered.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>


Referenced by