Render problem + AJAX

Hello,

I have a problem with forms, the problem is i have a form but when i
submit it i want to render a different thing depending on some params.

one time i want to update a div
the other time i want to go to another page

the problem is to update a div i have to use form_remote_tag and a
partial
and for the other page i need to use the regular form_tag

when i update the div i also need to give some parameters to it.

does anybody know a solution for this?

thnx in advance
Daan P.

tried to do it with an rjs template for the partial but then you also
need a form_remote_tag

Daan P. wrote:

tried to do it with an rjs template for the partial but then you also
need a form_remote_tag

Daan,
What you have to do is use form_remote_tag and a partial for the ajax
direction, and then use a render :update with “page.redirect_to” to “get
out of ajax” in the other direction.

So you set it up as a normal ajax encounter, but then you use
“page.redirect_to” as a “get out of ajax free card” to do a normal
non-ajax rendering of some other controller/action page.

The ajax side of it can be either with render :update or an rjs
template, as per usual.

hth,
jp

thnx i hope this will work :slight_smile:

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