Re: Force an ajax window to close

2011-03-30 Thread Calvin Spealman
You could add a header to the HTTP response that the JS on the
clientside can see and interpret as "OK, this is ready to close now."
I have done something similar to cause ajax-submitted forms to cause a
redirect in the containing page.

On Wed, Mar 30, 2011 at 10:24 PM, Mike Ramirez  wrote:
> On Wednesday, March 30, 2011 06:36:56 pm CrabbyPete wrote:
>> I have a ajax form using smoothbox and mootools to show a form.
>> Smoothbox has a button to close the box, but I want to force it closed
>> once the submit button is pressed and the form validated. Is there a
>> way django can close a browser window?
>
> This is a javascript problem.  Thing is that django is completely server side,
> the client knows nothing of django and it's functionality, even when using
> ajax, this is still all javascript on the client side.  Wtih that said
> window.close() in the 'popup' you've opened with the form would work.
> Becareful that you don't do this in the main window, you're not allowed to, it
> only works with a window that has a parent and you opened with javascript.
> Safety first.
>
> Mike
>
> --
> The truth of a thing is the feel of it, not the think of it.
>                -- Stanley Kubrick
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Force an ajax window to close

2011-03-30 Thread Mike Ramirez
On Wednesday, March 30, 2011 06:36:56 pm CrabbyPete wrote:
> I have a ajax form using smoothbox and mootools to show a form.
> Smoothbox has a button to close the box, but I want to force it closed
> once the submit button is pressed and the form validated. Is there a
> way django can close a browser window?

This is a javascript problem.  Thing is that django is completely server side, 
the client knows nothing of django and it's functionality, even when using 
ajax, this is still all javascript on the client side.  Wtih that said 
window.close() in the 'popup' you've opened with the form would work.  
Becareful that you don't do this in the main window, you're not allowed to, it 
only works with a window that has a parent and you opened with javascript. 
Safety first.

Mike

-- 
The truth of a thing is the feel of it, not the think of it.
-- Stanley Kubrick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.