Form in fancybox/modal dialog

Hi,

I want to do some pop-up/modal dialog (I’m not sure what’s the real
name of it :/) with a form inside
and after save that data I want that the form close…

As a example I’ve done this

<%= link_to “Add more”,
{:controller=>“users”, :action=>“new”}, :remote => true, :id => “pop”
%>

and this
$(document).ready(function{
$(“pop”).fancybox();
});

But theres a problem… after I save, inside the popup/modal appears
an error … and when I close it, I have to hit refresh in order to
see what’s been added.

I know that I have to use some javascript in order to make the new
element appear on the table, but how can I make that the modal/popup
disappears after save?

Thanks in advance

Javier Q.

On Tue, Dec 20, 2011 at 5:37 PM, JavierQQ [email protected] wrote:

%>
I know that I have to use some javascript in order to make the new
element appear on the table, but how can I make that the modal/popup
disappears after save?

Fancybox has a function for this:

$.fancybox.close

$(document).ready(function{

$(“pop”).fancybox();

});

$.fancybox.close

I’ve been reading about it and yes, fancybox has that… but how does it
knows if it was ok or not?

Regards

Javier Q