Is there any way to make an Ajax call (like link_to_remote) and pass in the value of a field on screen? This seems obvious, but I can''t find anything... Thanks, Marcus -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060526/19178f23/attachment.html
Marcus Blankenship wrote:> Is there any way to make an Ajax call (like link_to_remote) and pass in > the value of a field on screen? This seems obvious, but I can''t find > anything...You could not use the helper and do this: <a href="#" onclick="new Ajax.Updater( ''resultsTarget'', url, { method: ''get'', parameters: pars, onComplete: function(request) { alert(''all done''); } }); return false;">link</a> Where url is the url of your controller/action and pars are the params you wanna pass. or write your own helper that does this. Didn''t see a way to do it with the existing one. :-) -- Posted via http://www.ruby-forum.com/.
He''s probably talking about the field value at the time the link is clicked. This can be done with the :with => parameter. Look into it. If you need more help let me know. Michael
Michael Trier wrote:> He''s probably talking about the field value at the time the link is > clicked. This can be done with the :with => parameter. Look into it.ah... would be nice if the api docs had that as part of link_to_remote options. Found it under observe_field :with "A JavaScript expression specifying the parameters for the XMLHttpRequest. This defaults to ?value?, which in the evaluated context refers to the new field value. If you specify a string without a "=", it?ll be extended to mean the form key that the value should be assigned to. So :with => "term" gives "?term?=value". If a "=" is present, no extension will happen." Thanks! will try that. -- Posted via http://www.ruby-forum.com/.