Michael Pavling wrote in post #1017715:
My main demand is to pop up a form that will be populated by an ajax
call (I don't really want to render "display:none;" all the possible
forms, and show relevant ones when clicked)
A simple way to 'disable' all visible stuff is to put a (transparent)
div over the whole 'screen' and to put the 'modal form' above (inside or
Yeah, I get the general gist, it's the exact implementation with Rails
that I'm curious about.
Do I use RJS to update the page, or do I do remote_link_to with the
:update parameter set? How do I structure the controller to show and
then hide again?
Stuff like that...
Take a look at Ryan Johnson's Control.Modal (maybe renamed to Control.Window) widget for an extremely well-thought-out (prototype.js) modal dialog. As far as how to invoke it from Rails, the rule of unobtrusive scripting is that first you make sure that it works without any script. Normal controller paths FTW! Then use the respond_to handlers to make sure that you only render the partial for your form (no layout) when the request is :xhr.
Read Ryan's extensive documentation for examples of how to request a path, but hijack it into a modal overlay instead of rendering into the entire window.
You can decorate your login form with the Ajax behavior like this:
Everything else should just work.