How to use JavaScript in link_to_remote?

Cheers,

I have a form with an input inside that I want to be able to submit by
itself (I want to let the user create new tags with this input and use
them
to tag the whole content that is posted by the rest of the form).

I have this layout:

<%= link_to_remote "Schlüsselwort hinzufügen",:url => { :action => "ajax_add_tag", .... }" %>

The ":with => “‘tag=’ + $F(‘new_tag’)” stuff like in observe_field does
not
work and I cannot specify the tag like “:tag = XXX” because its value is
unknown at render time. The user enters it so I have to use JavaScript
like
with observe_field.

The problem is that link_to_remote does not accept JavaScript.

How do I solve this?

Thanks,
Jonathan


Jonathan W.
http://blog.innerewut.de

i know this is probably really simple, but how do i apply a patch to
rails?
i’m especially interested in using the upload_progress patch
http://dev.rubyonrails.org/attachment/ticket/1026/upload_progress_1356-2.diff

thanks in advance!
steve

On Sun, Dec 11, 2005 at 10:25:18AM -0800, Blair Z. wrote:

Index: actionpack/test/controller/multipart_progress_test.rb

I’ve got a little function in my .zshrc (from the toolkit of Mr. DHH) to
cut
out a step:

function pap { curl -s $1 | patch -p0 }

Then, given the above actionpack patch it’s just:

% cd /path/to/rails
% pap
http://dev.rubyonrails.org/attachment/ticket/1026/upload_progress_1356-2.diff?format=txt

marcel

Stephen Karsch wrote:

i know this is probably really simple, but how do i apply a patch to rails?
i’m especially interested in using the upload_progress patch
http://dev.rubyonrails.org/attachment/ticket/1026/upload_progress_1356-2.diff

Stephen,

You download the plain text or original format of the patch:

http://dev.rubyonrails.org/attachment/ticket/1026/upload_progress_1356-2.diff?format=txt
http://dev.rubyonrails.org/attachment/ticket/1026/upload_progress_1356-2.diff?format=raw

Then look at the first line of the file, in this case

Index: actionpack/test/controller/multipart_progress_test.rb

So you need to cd into the directory that properly lists that location.
In this
case, since multipart_progress_test.rb is a new file, you can’t ls it
from that
location, but you can find the directory path
‘actionpack/test/controller’. So
you’d probably want to cd into my-rails-project/vendor/rails/.

Then you do

patch -p0 < /where/you/saved/your/patch.txt

Regards,
Blair


Blair Z., Ph.D.
[email protected]
Subversion and Orca training and consulting
http://www.orcaware.com/svn/