• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prototype Modal Window Redirection problem

#1
[eluser]millisami[/eluser]
I'm using prototype window for the login form.
This is the link that will create a model login window.
Code:
<a href="[removed]openModalDialog()">Click here to open a modal window</a>

function openModalDialog() {
debug($('modal_window_content'));
var win = new Window('modal_window', {className: "alphacube", title: "Login",  width:500, height:300, zIndex:150, opacity:1, draggable:false, resizable: false});
win.setAjaxContent('user/loginajax');
win.setDestroyOnClose();
win.showCenter();
win.show(true);
}
If the login fails, the error message is shown in the same modal window.
But the problem is, when the login is successful and in the function loginajax() if I put the code
Code:
redirect("/dashboard");
the content of the dashboard is loaded in the same windows instead of loading in the main parent window.
To overcome this, what I did is, I returned a responseText 'successfull' and compared it as follow
Code:
if (req.responseText == 'successfull') {
Windows.focusedWindow.destroy();
location.href='/dashboard';
}
But I don't think to load it via javascript location.href is a feasible way.
So, is there any other way to redirect and load the dashboard page in the parent window from the controller function itself?
Thanks

#2
[eluser]jkevinburton[/eluser]
have you tried parent.location.href="path/to?";
OR
top.location.href="path/to?";

im just guessing at this point.. i have looked into the prototype window API

#3
[eluser]millisami[/eluser]
[quote author="[CoDeR]" date="1188677928"]have you tried parent.location.href="path/to?";
OR
top.location.href="path/to?";

im just guessing at this point.. i have looked into the prototype window API[/quote]
I think that you didn't understand the problem clearly.

Yes, it works just with location.href="path/path2";
But my question is, when the modal dialog is open and if I use redirect("path/path2"); in the controller's action, this redirected file is loaded in the modal window itself.
I don't want to use location.href="path/path2"; if there is any alternative, I want to do it via controller action.

Thanks


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.