Submit_tag image?

How does one assign an image in place of a simple button in ruby/rails?
For instance, my submit tag for searching looks like:

<%= form_tag :action =>‘search’, :controller => ‘search’ %>
<%= text_field_with_auto_complete :product, :title %>
<%= submit_tag “Go” %>
<%= end_form_tag %>

And it works fine but looks a little ugly. I’d like to replace the ‘Go’
with an image of a magnifying glass or something. What’s the best way
to do that?

Thanks…

image_submit_tag

http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M000503

c.

Vince W. wrote:

How does one assign an image in place of a simple button in ruby/rails?
For instance, my submit tag for searching looks like:

<%= form_tag :action =>‘search’, :controller => ‘search’ %>
<%= text_field_with_auto_complete :product, :title %>
<%= submit_tag “Go” %>
<%= end_form_tag %>

And it works fine but looks a little ugly. I’d like to replace the ‘Go’
with an image of a magnifying glass or something. What’s the best way
to do that?

Thanks…

you can supply an id to the submit tag and use an image to replace the
button.

…This would make a great helper if someone wrote a little code to
automtically add the image as a button if supplied!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs