Button_to_function with image?

Hi:

does button_to_function allow the use of an image? I tried it in place
of the text with “image_tag” and it doesn’t work. Maybe some form of
button_to?

Any direction you can give would be great!

Mike

Mike,

does button_to_function allow the use of an image? I tried it in
place
of the text with “image_tag” and it doesn’t work. Maybe some form
of
button_to?

I couldn’t find a way to pass an image as parameter, but you can
fabricate it yourself.

<%= content_tag(:button, image_tag(“ok.png”)+“Submit”, :type =>
“submit”) %>

A good candidate for a helper.

Alain R.

http://blog.ravet.com

Alain R. wrote:

Mike,

does button_to_function allow the use of an image? I tried it in
place
of the text with “image_tag” and it doesn’t work. Maybe some form
of
button_to?

I couldn’t find a way to pass an image as parameter, but you can
fabricate it yourself.

<%= content_tag(:button, image_tag(“ok.png”)+“Submit”, :type =>
“submit”) %>

A good candidate for a helper.

Alain R.

http://blog.ravet.com

Hi Alain:

Thank you so much! It worked. But here’s what I did:
<%= content_tag(:button, image_tag(“btn_send.gif”), :type => “submit”,
:onclick => “closeiframe();”) %>
So when I do this, it puts a button-box around “image_tag”. Any further
suggestions???

Thanks again!

Mike

Mike,

But here’s what I did:
<%= content_tag(:button, image_tag(“btn_send.gif”), :type =>
“submit”, :onclick => “closeiframe();”) %>
So when I do this, it puts a button-box around “image_tag”.

Yep. That’s what you’re looking for, arent’t you?
see:
Particletree » Rediscovering the Button Element

Note: if you don’t need text in the button, there is :
image_submit_tag
Peak Obsession

Alain R.

http://blog.ravet.com

Mike D. wrote:

Hi:

does button_to_function allow the use of an image? I tried it in place
of the text with “image_tag” and it doesn’t work. Maybe some form of
button_to?

Any direction you can give would be great!

Mike

Mike, give this a go.

link_to_function(image_tag(“delete”), “if (confirm(‘Really?’))
do_delete()”)
Produces:

Delete

RJS template:

<%= link_to_function image_tag(‘foo.jpg’, :class => “foobar”) do |page|
page.visual_effect :blind_up, “foo_#{@bar.id}”
page.show “foo_#{@bar.id}”
end %>

I also recommend you visit:
http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#M001061

Hi,

Is there a way to have both text and image in button_to_function?

Neha

On Dec 26 2007, 9:20 am, Fulvio Cusumano <rails-mailing-l…@andreas-

Hi,

Is there a way to have both text and image in button_to_function?

Neha

On May 20 2007, 9:05 am, Mike D. <rails-mailing-l…@andreas-