Hi,
I'm using standard Rails form builder form_for and haml. I'm trying to replace standard Rails submit button with an image. In addition Javascript runs on submit event. How can I replace the f.submit button by an image-based button?
Hi,
I'm using standard Rails form builder form_for and haml. I'm trying to replace standard Rails submit button with an image. In addition Javascript runs on submit event. How can I replace the f.submit button by an image-based button?
I don't know much about haml, but I wanted the same thing than you. Here's what I did
<% form_remote_tag( :url=>{:action=>'moderate', :controller=>'messages'}, :html=>{:id=>'new_message_form'}, :complete=>"Form.reset('new_message_form')") do %> <%= hidden_field_tag 'whatever' %> <p> Text<br /> <%= text_area 'message', 'text', :rows=>3 %> </p> ...... <p> <%= image_submit_tag "button.png", :name => "submit", :onClick => "some JS here" %> </p> <% end %>
Hope this helps,
Christophe