RJS call in :complete of form_remote_tag


#1

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


#2

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


#3

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?


#4

Use a form_remote tag and then post it to the controller. Call an RJS
action from there. That should work.

Vish


#5

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


#6

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.