submit_to_remote with image

View: New views
9 Messages — Rating Filter:   Alert me  

submit_to_remote with image

by JannaB :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: submit_to_remote with image

by bill walton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Janna,

On Thu, 2009-07-09 at 08:44 -0700, JannaB wrote:
> 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?

link_to_remote takes an image_tag in place of the name text and
the :submit option.

image_submit_tag will give you a straight HTTP submit with an image
instead of a button.

HTH,
Bill


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: submit_to_remote with image

by Aljaz Fajmut :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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'") %>

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: submit_to_remote with image

by JannaB :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ok, but I cannot have a submit_to_remote with an image, right?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: submit_to_remote with image

by Frederick Cheung-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




On Jul 9, 4:44 pm, JannaB <mistressja...@...> wrote:
> 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?

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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: submit_to_remote with image

by JannaB :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: submit_to_remote with image

by Frederick Cheung-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




On Jul 9, 8:57 pm, JannaB <mistressja...@...> wrote:

> 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
> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: submit_to_remote with image

by s.ross :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello--

On Jul 9, 2009, at 8:44 AM, JannaB wrote:

>
> 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?

It looks, from some of your recent posts, that the Javascript helpers  
may be more of an impediment than a help to you. The JS helpers work  
great for the things they were designed to do. Many people prefer  
simply to use Prototype or jQuery without any Rails magic. It's not  
much harder and you your own code almost always bends to your will.

Just a thought.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: submit_to_remote with image

by gautam chekuri :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I wanted to something similar and ended up monkey-patching
JavaScriptHelper ...
http://groups.google.ca/group/rubyonrails-talk/browse_thread/thread/244e24285d3d883d

On Jul 9, 8:44 pm, JannaB <mistressja...@...> wrote:
> 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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---