On 22 Feb 2008, at 11:25, Frank Preiswerk wrote:
>
> Hi there,
>
> does anyone know if it is possible to generate remote_function calls
> in
> a dynamic fashion similar to this:
>
> <%= remote_function(:url => {:action => "setComponent",
:component =>
> comp, :value => document.getElementById("...").value})%>
>
> where I don''t want to evaulate the document.getElementById part
but
> rather want to pass this javascript code to the Ajax.Request object
> for
> later evaluation.
>
> The problem here is that the document.getElementById("...").value
part
> is passed to the resulting Ajax.Request object as a string:
>
> new
> Ajax.Request(''/epacs/setComponent?
> component=3&value=document.getElementById(...).value'',
> {asynchronous:true, evalScripts:true})
>
> and seems to be never evaluated but rather passed to the server as a
> string.
>
You need to use the :with option (ie remote_function :url =>
{...}, :with => ...)
Fred.
> How do I create this remote_function call so that the javascript is
> evaluated at the very same time that the Ajax.Request is fired?
>
> Thanks a lot!
> --
> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---