Hi.
I need to do an Ajax call to populate a span-tag with some text from
the server-side. I''m using ''link_to_remote'' but I
need to fetch one of
the parameters in the call from a form field.
Initially I tried something like:
<%= link_to_remote ''....'', :url => {:action =>
''some_action'', :id => ''$
(some_form_field).value;''}, :update =>
''target_span'' %>
This will obviously not work.
But - is there an easy way to do this using the Rails helpers? I
suppose it would be possibly by writing some custom Javascript - but
I''m trying to avoid that.
Best Regards //Anders
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
I''ll go ahead and answer my own question :)
I managed to solve my specific problem by using the ''submit''
parameter:
<%= link_to_remote ''....'', :url => {:action =>
''some_action''}, :update
=> ''target_span'', :submit =>
''id_of_container_holding_the_input_form''
%>
See http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater where
the ''submit'' parameter is described.
//Anders
On Apr 24, 9:41 am, Anders Engström
<epirea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi.
>
> I need to do an Ajax call to populate a span-tag with some text from
> the server-side. I''m using ''link_to_remote'' but
I need to fetch one of
> the parameters in the call from a form field.
>
> Initially I tried something like:
>
> <%= link_to_remote ''....'', :url => {:action =>
''some_action'', :id => ''$
> (some_form_field).value;''}, :update =>
''target_span'' %>
>
> This will obviously not work.
>
> But - is there an easy way to do this using the Rails helpers? I
> suppose it would be possibly by writing some custom Javascript - but
> I''m trying to avoid that.
>
> Best Regards //Anders
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
That''s exactly what I was looking for! I couldn''t find the description on the script.aculo.us-wiki. Could you (or anyone else) point me to a website where the usage of link_to_remote''s :submit-parameter is described? The rails API-docs arent very substantial regarding this... My main-question is: How do I fetch the submitted parameter in the controller method? Using params[:submit]? On 24 Apr., 13:43, Anders Engström <epirea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ll go ahead and answer my own question :) > > I managed to solve my specific problem by using the ''submit''parameter: > > <%=link_to_remote''....'', :url => {:action => ''some_action''}, :update > => ''target_span'', :submit=> ''id_of_container_holding_the_input_form'' > %> > > Seehttp://wiki.script.aculo.us/scriptaculous/show/Ajax.Updaterwhere > the ''submit''parameteris described. > > //Anders > > On Apr 24, 9:41 am, Anders Engström <epirea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi. > > > I need to do an Ajax call to populate a span-tag with some text from > > the server-side. I''m using ''link_to_remote'' but I need to fetch one of > > the parameters in the call from a form field. > > > Initially I tried something like: > > > <%=link_to_remote''....'', :url => {:action => ''some_action'', :id => ''$ > > (some_form_field).value;''}, :update => ''target_span'' %> > > > This will obviously not work. > > > But - is there an easy way to do this using the Rails helpers? I > > suppose it would be possibly by writing some custom Javascript - but > > I''m trying to avoid that. > > > Best Regards //Anders--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---