Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 578
hyperrjas Avatar asked May 07 '12 11:05

hyperrjas


1 Answers

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

like image 188
hyperrjas Avatar answered Nov 03 '22 00:11

hyperrjas