Has anyone ever updated a form textbox field in a parent window from a child window? I''ve asked this looked for and question in various places and have not received any responses. Is this impossible to do? I''ve tried link_to_remote and link_to_function and none of this is updating my parent window for me. I thought that link_to_function would be a good bet, but my Javascript isn''t doing anything - either I get an XML attribute error or no errors and no updates. Have I really hit the wall and need to abandon this idea? -- 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''ve never heard of any way to do this client-side (in the browser). I would set the parent window to use link_to_remote to send the information to the server, and then periodically have the child check back with the server for updates from the parent.. -- 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 -~----------~----~----~----~------~----~------~--~---
Bryan M. wrote:> I''ve never heard of any way to do this client-side (in the browser). I > would set the parent window to use link_to_remote to send the > information to the server, and then periodically have the child check > back with the server for updates from the parent..Thanks for your reply. The problem is that this is part of a form and so if a user updates part of the form and then opens the pop-up box, the rest of the form details will be lost. -- 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 -~----------~----~----~----~------~----~------~--~---
On Fri, May 2, 2008 at 2:00 PM, Becca Girl <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Has anyone ever updated a form textbox field in a parent window from a > child window? I''ve asked this looked for and question in various places > and have not received any responses. Is this impossible to do?AFAIK, yes. The parent window can address the child because it has a handle to it -- the var from e.g. var child_window = window.open("child_form.html","child_window",args); So the parent can initiate interaction with the child, but not the other way around. You could have the parent "poll" the child every second or two for changes. Or as mentioned write the child''s data directly to the server asynchronously. HTH, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hassan Schroeder wrote:> AFAIK, yes. The parent window can address the child because it > has a handle to it -- the var from e.g. > > var child_window = window.open("child_form.html","child_window",args); >I had really thought that I could use link_to with a javascript function, but I''m not finding working code. So if I abandon that idea, could would there be a way to utilize a partial just for that textarea and have that partial update, but not the rest of the form? Will that work? Oh, the bad code that I can see coming now. -- 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 -~----------~----~----~----~------~----~------~--~---
On May 2, 11:21 pm, Becca Girl <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hassan Schroeder wrote: > > AFAIK, yes. The parent window can address the child because it > > has a handle to it -- the var from e.g. > > > var child_window = window.open("child_form.html","child_window",args); > > I had really thought that I could use link_to with a javascript > function, but I''m not finding working code. >That''s what link_to_function does. And the child window can access its parent. I''ve done this in the past by having a function in the parent window that did whatever I needed and then calling opener.some_function() from the child window. Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > That''s what link_to_function does. And the child window can access its > parent. I''ve done this in the past by having a function in the parent > window that did whatever I needed and then calling > opener.some_function() from the child window. >Almost forgot, one big caveat to that: both pages need to be served from the same domain. Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Fri, May 2, 2008 at 3:37 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> opener.some_function() from the child window.well, son of a gun. "opener" is the magic word :-) Is that well-supported across the major browsers? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:>> >> That''s what link_to_function does. And the child window can access its >> parent. I''ve done this in �the past by having a function in the parent >> window that did whatever I needed and then calling >> opener.some_function() from the child window. >> > > Almost forgot, one big caveat to that: both pages need to be served > from the same domain. >Same domain meaning the same controller or literally both in the same www.domain.com? The pop up has a different model & controller than the parent. But my thought was that the Javascript shouldn''t care about that and only deal with parent and child windows. This is what I had, but it doesn''t update my parent. Any thoughts on how to make this code work? <%=link_to_function("the link", "window.opener.document.getElementById(''item_field'').value = ''#{@item_codes}'';self.close() %> -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 2 May 2008, at 23:54, Becca Girl wrote:> > Frederick Cheung wrote: >>> >>> That''s what link_to_function does. And the child window can access >>> its >>> parent. I''ve done this in �the past by having a function in the >>> parent >>> window that did whatever I needed and then calling >>> opener.some_function() from the child window. >>> >> >> Almost forgot, one big caveat to that: both pages need to be served >> from the same domain. >> > > Same domain meaning the same controller or literally both in the same > www.domain.com?Same combination of domain name, protocol (http or https) and port> > > The pop up has a different model & controller than the parent. But my > thought was that the Javascript shouldn''t care about that and only > deal > with parent and child windows. > > This is what I had, but it doesn''t update my parent. Any thoughts on > how to make this code work? > > <%=link_to_function("the link", > "window.opener.document.getElementById(''item_field'').value > ''#{@item_codes}'';self.close() %> >That works for me (alhough i used opener.document.forms[''answer_form''].reply.value = ''xyz'') Also self.close() isn''t going to do anything (since javascript uses this not self and because in this context this will be the link itself). Fred> -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 2 May 2008, at 23:50, Hassan Schroeder wrote:> > On Fri, May 2, 2008 at 3:37 PM, Frederick Cheung > <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> opener.some_function() from the child window. > > well, son of a gun. "opener" is the magic word :-) > > Is that well-supported across the major browsers?As far as I know. Fred> -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > --~--~---------~--~----~------------~-------~--~----~ > 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/ > ru--~--~---------~--~----~------------~-------~--~----~ 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 for all of the great help!!! I am so close to getting this to work. This works in FF, IE and Safari. Here''s the final code that I used to put the values into the text area. <%=link_to_function("[close window]", "opener.document.getElementById(''form_field'').value = ''#{@list}'';self.close();") %> The pop up window that opens contains partials for the drag and drop. I have the initial select list, the list of items that have been selected and the area for dragging unwanted items. The only hiccup now is that for me to get this to work, I have to have the link_to_function in the partial with the selected values otherwise the textarea is not updated. Any thoughts? -- 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 -~----------~----~----~----~------~----~------~--~---
My work-around is to have the link_to_function in a partial that gets updated when the other partials are updated. This works. Better ideas would be appreciated. -- 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 -~----------~----~----~----~------~----~------~--~---