Forum: Ruby on Rails RJS call in :complete of form_remote_tag

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.
Max (Guest)
on 2007-06-18 01:39
(Received via mailing list)
Hi,

this should be easy:

I have a "test.rjs" and I want to call it from the :complete of a
form_remote_tag.

How would I do that?

Thanks,
Max
Bill W. (Guest)
on 2007-06-18 01:55
(Received via mailing list)
Hi Max,

Max wrote:

> I have a "test.rjs" and I want to call it from the :complete
> of a form_remote_tag.
>
> How would I do that?

I'm not sure you can.  I'm pretty sure that the callback options on
form_remote_tag are only useful for calling javascript that's already in
the
page that's loaded in the browser.

Bill
Max (Guest)
on 2007-06-18 02:37
(Received via mailing list)
> I'm not sure you can.  I'm pretty sure that the callback options on
> form_remote_tag are only useful for calling javascript that's already in the
> page that's loaded in the browser.

So where should I put the code instead?
Bill W. (Guest)
on 2007-06-18 04:28
(Received via mailing list)
Hi Max,

Max wrote:

>> I'm not sure you can.  I'm pretty sure that the callback
>> options on form_remote_tag are only useful for calling
>> javascript that's already in the page that's loaded in the
>> browser.
>
> So where should I put the code instead?

That would depend on what you're trying to do.  You didn't post the .rjs
so
I can't say for sure.  In general, given what you've said, if you want
to
execute javascript on completion of the form submission, I'd say write
the
javascript, put it in application.js, and it'll be available to you on
:complete.

hth,
Bill
Vishnu G. (Guest)
on 2007-06-18 08:35
(Received via mailing list)
Use a form_remote tag and then post it to the controller. Call an RJS
action from there. That should work.

Vish
Max (Guest)
on 2007-06-20 13:21
(Received via mailing list)
> Use a form_remote tag and then post it to the controller. Call an RJS
> action from there. That should work.

Thanks, I solved my initial problem in a completely different way, but
I'll come back to it and try that.
This topic is locked and can not be replied to.