submit_to_remote with image

Anyone have an idea how I can shoehorn (or workaround) a
submit_to_remote to accept html options so that I might put an image
to it?

Hi Janna,

Janna,

image_submit_tag has a nasty effect of not applying rollover but I got
it to work by calling javascript directly:

<%= image_submit_tag('/images/your_main_image.jpg',
            :title => "Search",
            :class => "btnsearch",
            :onmouseover =>
"this.src='/images/your_rollover_image.jpg'",
            :onmouseout => "this.src='/images/your_main_image.jpg'") %>

Ok, but I cannot have a submit_to_remote with an image, right?

if you do submit_to_remote blah, blah, :html => {...}

then that options hash is passed to button_to_remote (and thus
button_to_function etc.)

Fred

Fred,

I thnk you may be wrong on this (for once!) -or-, more likely, I cant
find the right hash key for the image (I'm unable to discern the
correct syntax).
For example, the following works, but, my problem is that it doesn't
pick up the values of other controls on the form:

<%= link_to_remote image_tag("/images/icecube.gif"), {:url =>{:action
=> 'freezer'}} %>

when I follow what (I think) you have suggested:

<%= submit_to_remote 'Freezer', 'freezer', {:url => { :action =>
'freezer' }, :name => image_tag("/images/icecube.gif")} %>

doesn;t pick up the image. But The hash key may be something other
than 'name' (I have tried, 'image,' and 'img' but I dont see how this
would map to the name parameter in link_to_remote) -Janna B

Fred,

I thnk you may be wrong on this (for once!) -or-, more likely, I cant
find the right hash key for the image (I'm unable to discern the
correct syntax).
For example, the following works, but, my problem is that it doesn't
pick up the values of other controls on the form:

<%= link_to_remote image_tag("/images/icecube.gif"), {:url =>{:action
=> 'freezer'}} %>

when I follow what (I think) you have suggested:

<%= submit_to_remote 'Freezer', 'freezer', {:url => { :action =>
'freezer' }, :name => image_tag("/images/icecube.gif")} %>

That wasn't what I was getting at.
if you do submit_to_remote 'Freezer', 'freezer', :url => { :action =>
'freezer' }, :html => {...}
then that will set html options on the input element that is
generated.

Fred

Hello--