RJS - loading a layout first?

Hiya,

I am trying to create a login system that once a user clicks login needs
to change the layout, then the RJS will replace various divs, but the
RJS seems to render before the layout change so it can’t find the divs.
I’m sure I’m missing something simple!

Any help would be fantastic :smiley:
Bex

You need a layout change? Just post to a new page altogether and forget
the
RJS.

Jason

Becky F. wrote:

Hiya,

I am trying to create a login system that once a user clicks login needs
to change the layout, then the RJS will replace various divs, but the
RJS seems to render before the layout change so it can’t find the divs.
I’m sure I’m missing something simple!

Any help would be fantastic :smiley:
Bex

RJS shouldn’t care about a layout at all. I have a widget in my app
that upadte the shopping cart element which is in the layout and it
works fine. If you want to change a div via RJS it will work that same
way whether the div is in the template or the layout since its all just
divs to the browser itself, and the browser is what executes the
javascript.

The only reason I can see a problem with this is if you are relying on
the layout to create variable which you use in the RJS template. This
is a bad idea since you shouldn’t be assigning variables in your view at
all, and the layout will never be executed when rendering RJS at all.