RJS call in :complete of form_remote_tag

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

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

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?

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

Vish

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

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs