tags:

views:

79

answers:

1

How do I include the 'autofocus' attribute on an HTML5 form using the text_field form helper in ruby?

e.g. <%= f.text_field :email %> Where does autofocus go?

Thanks

+1  A: 

f.text_field :email, :autofocus=>"true"

though, not sure if the value is "true" or "autofocus"

Pedro Morte Rolo
Ah, that works. Was looking it to generate <input id="user_email" name="user[email]" type="text" autofocus>But autofocus="true" works too.Thanks
Lee
For me, the autofocus="true" doesn't work and the autofocus=>"true" just works when displaying the page with Chrome and Arora (not with IE and Firefox)...
Michaël
@Michaël: Try autofocus=>"autofocus"
Pedro Morte Rolo
@Pedro: It's very strange because it doesn't change anyting...
Michaël