Hi, In my application, when user clicks on a link, I need to show a form in a popup window. Popup has to close when form is submitted. If the form data is valid then I need to go to action A in main browser else I need to go to action b. how do I do it i.e. redirect the main window? Thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think it''s something like "parent.location = ..." in the onload function of your popup... google should be able to fill in the detail nicely. b Rm Rm wrote:> Hi, > > In my application, when user clicks on a link, I need to show a form in > a popup window. Popup has to close when form is submitted. If the form > data is valid then I need to go to action A in main browser else I need > to go to action b. how do I do it i.e. redirect the main window? > > Thanks. >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
But the form is submitted to an action in rails. From my rails action, view A or B appear in popup. what I need is that popup should close when form is submitted, and the main browser should either be redireced to A or B. Ben Munat wrote:> I think it''s something like "parent.location = ..." in the onload > function of your popup... google should be able to fill in the detail > nicely. > > b-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Form gets submitted -> depending on wiehter form was valid or not, rails will render a (slightly) different view. it should render something like this: <head> <script> function redirect_and_close(newlocation) { parent.location.href = newlocation; window.close; } </script> </head> <body onLoad="redirect_and_close(''http://new.location.com'')"> ... your view''s body code here ... </body> not sure if my Javascript is 100% correct, but you should get the idea and google should do the rest, you wil find much about parent & location easily. On 14 Feb., 07:18, Rm Rm <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> But the form is submitted to an action in rails. From my rails action, > view A or B appear in popup. what I need is that popup should close when > form is submitted, and the main browser should either be redireced to A > or B. > > Ben Munat wrote: > > I think it''s something like "parent.location = ..." in the onload > > function of your popup... google should be able to fill in the detail > > nicely. > > > b > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks. It worked. Thorsten L wrote:> Form gets submitted -> depending on wiehter form was valid or not, > rails will render a (slightly) different view. > it should render something like this: > > <head> > <script> > function redirect_and_close(newlocation) { > parent.location.href = newlocation; > window.close; > } > </script> > </head> > <body onLoad="redirect_and_close(''http://new.location.com'')"> > ... your view''s body code here ... > </body> > > not sure if my Javascript is 100% correct, but you should get the idea > and google should do the rest, you wil find much about parent & > location easily.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---