add :onchange => "readURL(this)" to input file on simple_form

ruby-on-rails, ruby-on-rails-3, ruby-on-rails-3.1, simple-form

Solution

The fix:

<%= f.input :image, :as => :file, :input_html => {:onchange => "readURL(this)"} %>

Thank you to Carlos Antonio da Silva in.

http://groups.google.com/group/plataformatec-simpleform/browse_thread/thread/6f2cdd83e2dbf51c

Problem

I have a problem with this: I want add `:onchange => "readURL(this)"` to my: ``` <%= f.input :image, :as => :file, :onchange => "readURL(this)" %> ``` I have tried with: ``` <%= f.input :image, :as => :file, :html => {:onchange => "readURL(this)"} %> ``` but I can not see the `onchange="readURL(this)"` in html code. How can I fix this problem? Thank you again :D.

Original source