add:onchange =>"readURL(this)"在simple_form上输入文件

hyp*_*jas 9 ruby-on-rails ruby-on-rails-3 simple-form ruby-on-rails-3.1

我有一个问题:

我想加 :onchange => "readURL(this)"我的:

<%= f.input :image, :as => :file, :onchange => "readURL(this)" %>
Run Code Online (Sandbox Code Playgroud)

我尝试过:

<%= f.input :image, :as => :file, :html => {:onchange =>
"readURL(this)"} %>
Run Code Online (Sandbox Code Playgroud)

但是我看不到 onchange="readURL(this)"html代码.

我该如何解决这个问题?

再次感谢你:D.

hyp*_*jas 24

修复:

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

谢谢Carlos Antonio da Silva.

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