Forum: Ruby on Rails How to use JavaScript in link_to_remote?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6805b35d0a8ea3ede0a7da2d4cf5ae77?d=identicon&s=25 jw (Guest)
on 2005-12-10 17:33
(Received via mailing list)
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:

<form ...>

  <input type="text" id="new_tag" />
   <%= link_to_remote "Schl├╝sselwort hinzuf├╝gen",:url => { :action =>
"ajax_add_tag", .... }" %>


</form>


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 Weiss
http://blog.innerewut.de
D6c13e82448f753fde1a51d79e59d92c?d=identicon&s=25 steve (Guest)
on 2005-12-10 18:02
(Received via mailing list)
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/...

thanks in advance!
steve
27c57aaa4bda5ac8b0593659573b522f?d=identicon&s=25 Blair Zajac (Guest)
on 2005-12-11 19:26
(Received via mailing list)
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/...

Stephen,

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

http://dev.rubyonrails.org/attachment/ticket/1026/...
http://dev.rubyonrails.org/attachment/ticket/1026/...

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 Zajac, Ph.D.
<blair@orcaware.com>
Subversion and Orca training and consulting
http://www.orcaware.com/svn/
Cee0292fffa691f1fb320d5400200e99?d=identicon&s=25 Marcel Molina Jr. (Guest)
on 2005-12-11 21:30
(Received via mailing list)
On Sun, Dec 11, 2005 at 10:25:18AM -0800, Blair Zajac 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/...

marcel
This topic is locked and can not be replied to.