neharohan.chopra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-01 16:49 UTC
Submitting a popup
Hi, I wanted to discuss one scenario. From a main window, I open a javascript popup window, in that i have a form_remote_tag call. On the completion of this call, i want some server side code to execute and form to be submitted, after that is done i want the pop up window to close and after that a DOM element to be updated in the main window. So am having trouble with the last part i.e. updating a DOM in my main window. So how can i make it work. Thanks in advance. Neha --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sorry I don''t have a direct answer for you, but you could make a CSS style popup in the main window using something like Redcloth. Then you don''t have to worry with two windows. On Feb 1, 11:49 am, "neharohan.cho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <neharohan.cho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I wanted to discuss one scenario. > > From a main window, I open a javascript popup window, in that i have a > form_remote_tag call. > On the completion of this call, i want some server side code to > execute and form to be submitted, after that is done i want the pop up > window to close and after that a DOM element to be updated in the main > window. > > So am having trouble with the last part i.e. updating a DOM in my main > window. > So how can i make it work. > > Thanks in advance. > > Neha--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
RedBox not Redcloth. Sorry. On Feb 1, 1:35 pm, Robert Walker <rwalker...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sorry I don''t have a direct answer for you, but you could make a CSS > style popup in the main window using something like Redcloth. Then you > don''t have to worry with two windows. > > On Feb 1, 11:49 am, "neharohan.cho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" > > <neharohan.cho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > > I wanted to discuss one scenario. > > > From a main window, I open a javascript popup window, in that i have a > > form_remote_tag call. > > On the completion of this call, i want some server side code to > > execute and form to be submitted, after that is done i want the pop up > > window to close and after that a DOM element to be updated in the main > > window. > > > So am having trouble with the last part i.e. updating a DOM in my main > > window. > > So how can i make it work. > > > Thanks in advance. > > > Neha--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I once did this: I created a javascript function in the main window that is able to update the DOM element. In the method that is called when submitting the form in the popup, I returned some RJS. Here I call the javascript function in the main window, reachable through "window.opener" It looks something like: page << "if(window.opener) window.opener.myUpdateFunction(someParams)" Greetings, Wouter -- 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 -~----------~----~----~----~------~----~------~--~---
Neha Chopra wrote:> So that means that when i do the form submission, i should return some > rjs, that will automatically invoke the javascript of the main window? > How will the javascript of main window be invoked?That''s correct. The example given executes a javascript function in the main window. When opening a popup, the popup window should have a DOM element called "opener", through which you can reach the main window. -- 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 -~----------~----~----~----~------~----~------~--~---
neharohan.chopra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-04 16:53 UTC
Re: Submitting a popup
Hi, I tired this today but somehow couldnt get it to work. I invoked a popup, then on form submission from the popup i rendered an RJS that has the code that says page << "if(window.opener) window.opener.myUpdateFunction()" and this myUpdateFunction() is a javascript function defined in the layout of the main window. but its not getting invoked. Any thoughts on this. On Feb 1, 2:01 pm, Wouter de Bie <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I once did this: > > I created a javascript function in the main window that is able to > update the DOM element. In the method that is called whensubmittingthe > form in thepopup, I returned some RJS. Here I call the javascript > function in the main window, reachable through "window.opener" > > It looks something like: > > page << "if(window.opener) window.opener.myUpdateFunction(someParams)" > > Greetings, > > Wouter > > -- > 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 -~----------~----~----~----~------~----~------~--~---