Issue 124: redirect after submitting a form in nyromodal overlay opens the new redirect page in nyromodal window
Status:  WontFix
Owner: ----
Closed:  Feb 2009
Reported by neerash...@gmail.com, Nov 30, 2008
What steps will reproduce the problem?
1. I have form with class="nyromodal" and display it in nyromodal overlay.
2. I press submit. Form is submitted. data is saved in db and then I do a
redirect to another page which is not nyromodal page
3. The new redirect page opens in nyromodal overlay window,even though it
is not nyromodal,
Dec 1, 2008
Project Member #1 nyro...@gmail.com
I'm not sure to figure out what is your problem.
Could you send a link or your HTML/CSS/JS pages please?
Dec 1, 2008
#2 hejda...@gmail.com
so why you're giving form a nyroModal class? If you don't so, then data are submited,
and "resulting" page is opened out of nyromodal overlay window :)
Dec 1, 2008
#3 neerash...@gmail.com
The reason I give the page nyromodal class is if there are validation errors in submitted form , I want form to 
come back in the modal window with errors. If I do not give nyromodal class, the form with validation error 
opens in main browser window. Validation is server side. 
Dec 18, 2008
#4 neerash...@gmail.com
I think hejda.cz figured out the problem but not the solution.
 As I mentioned I need to have nyroModal Class as validation errors of form need to be displayed back in 
nyromodal. 

Problem is once I successfully submit the form and server does the redirect, the redirected page also shows in 
nyromodal window, even though the page has no nyromodal class defined. 
Dec 18, 2008
Project Member #5 nyro...@gmail.com
Please, send files or a link, it will be easier for me to understand and debug your
problem.
Jan 27, 2009
Project Member #6 nyro...@gmail.com
any news?
Did you check the example as there is a validation example?
Jan 29, 2009
#8 neerash...@gmail.com
what I have is

1. Parent page which has the link has
     
 $(document).ready(function(){
 
  $.nyroModalSettings({zIndex: 5}, 'css', 'bg');
            $.nyroModalSettings({zIndex: 6}, 'css', 'wrapper');
          $('#nyrolink a').nyroModal();
});

....In Html...

<div id="nyrolink">
                       <a  href="/nyrotest/new/{{form.id}}/" style="float:right;
text-decoration:underline;"> Add Data</a>
</div>         



2.  Clicking on this link throws html form in nyromodal window. Html form has
  <form action="/nyrotest/new/{{pcase_id}}/" method="POST" class="nyroModal">

3. On Submit, the request goes to server and on successful add, serverside code does
a redirect to another page...

4. This new page to which redirect is done opens in nyromodal window instead of
regular browser window even though this redirect page has no Nyromodal class or
nyromodal in javascript.

 I will try to create a demo example  and upload it.

thanks                     

Note: I am using Django, {{form.id}} is replaced by django template language on
server side. I am also using jquery hence the      
 $(document).ready
Jan 31, 2009
Project Member #9 nyro...@gmail.com
How do you redirect to the other page? (on step 3)
maybe that's where it's not good.
Feb 1, 2009
#10 neerash...@gmail.com
I use Django HttpResponseRedirect.
I do - return HttpResponseRedirect('/core/viewall/')

I believe Django just sets status code = 302 and returns HttpResponse.

here is the link for the code for Django HttpResponse and HttpResponseRedirect if it
helps,

http://code.djangoproject.com/browser/django/trunk/django/http/__init__.py


Feb 2, 2009
Project Member #11 nyro...@gmail.com
Maybe that's the problem. Try to not redirect the page to show directly the content
to see if it works.
Feb 16, 2009
Project Member #12 nyro...@gmail.com
(No comment was entered for this change.)
Status: WontFix
Feb 26, 2009
#13 smtlaiss...@gmail.com
I consider this a real issue.  It shouldn't be marked as WontFix.

To show the issue, I created a small screencast:

http://www.screencast.com/users/smtlaissezfaire/folders/Jing/media/53636afa-d399-4b64-8c8b-89e3ddb0ae3f


Feb 26, 2009
#14 smtlaiss...@gmail.com
Just to elaborate a bit more, when you successfully submit the form, you'll want the
whole window to be redirected, not just the content inside the modal.
Feb 26, 2009
#15 smtlaiss...@gmail.com
And just in case you won't fix this, here's a workaround that I've come up with:

Render the following html:

<script type="text/javascript">
  window.location.href = "/my/url"
</script>

Feb 27, 2009
Project Member #16 nyro...@gmail.com
I put this issue as "won't fix" because I didn't have any news from neerashish and it
looked like a PHP problem (the redirect stuff)

Your problem is different: it looks like you're using an iframe and that's why the
redirection occurs only in the iframe.
You guessed right with your last comment.

That's not a modal problem, but a normal way to work for browser.
Jan 4, 2011
#17 emrayd...@gmail.com
use

<script type="text/javascript">
window.parent.location = "redirect url"
</script>

I had the same problem and this worked well for me.