Ajaxy popups

I don't tend to have much to do with front-end stuff, but I need to
demo some ajaxy popup modal forms in a Rails 2.3 app (with Prototype).

Googling around gets me a few options... but nothing obviously *the one*.

http://www.methods.co.nz/popup/popup.html
http://prototype-window.xilinus.com/

Anyone out there using or used something they can recommend?

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)

TIA

No one?
Oh well... I'll have to muddle through manually :frowning:

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
after) that. Hope this helps, T.

jQuery dialog is your friend.

It's not friendly to me - I'm limited to Prototype methods for this :frowning:

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...

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
after) that.

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:

//application.js
document.observe('dom:loaded',function(){
  $('my_login_form').observe('submit',function(evt){
    evt.stop();
    this.request();
  });
});

Everything else should just work.

Walter