Adhiraj Rankhambe
2008-May-22 06:37 UTC
In-page popup not supporting DOM structure/properties
In my current app, I have an in-page popup(those semi-transparent ones like you find on Facebook) for login, which has only two fields: login and password. I am not able to set focus in the login field. document.getElementById(''element'').focus(); doesn''t seem to work. document.getElementById(''element'') returns "null". I have a link for ''Login'' on the ''Home Page''. When user clicks on the Login link, an in-page pop is rendered on the same page, so you can see the ''Home Page'' in the background, but focus is on the ''Login popup''. I think that''s because we have two layers of documents, one the ''Home Page'' and second the ''Login'' popup''. So something wrong with the DOM structure. Not sure... Does anyone know how to handle this situation? Thanks in advance Adhiraj -- 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-May-22 09:15 UTC
Re: In-page popup not supporting DOM structure/properties
On 22 May 2008, at 07:37, Adhiraj Rankhambe wrote:> > In my current app, I have an in-page popup(those semi-transparent ones > like you find on Facebook) for login, which has only two fields: login > and password. > I am not able to set focus in the login field. > > document.getElementById(''element'').focus(); doesn''t seem to work. > document.getElementById(''element'') returns "null". > > I have a link for ''Login'' on the ''Home Page''. When user clicks on the > Login link, an in-page pop is rendered on the same page, so you can > see > the ''Home Page'' in the background, but focus is on the ''Login popup''. > I think that''s because we have two layers of documents, one the ''Home > Page'' and second the ''Login'' popup''. So something wrong with the DOM > structure. Not sure...It shouldn''t require anything special, assuming all your markup is nice and tidy. You''re also asking for trouble if you''ve got multiple page elements with the same id (which can easily happen by accident) Fred> > > Does anyone know how to handle this situation? > > Thanks in advance > > Adhiraj > -- > 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 -~----------~----~----~----~------~----~------~--~---
Adhiraj Rankhambe
2008-May-22 13:59 UTC
Re: In-page popup not supporting DOM structure/properties
I am actually using this statement: document.getElementById(''login'').focus(); But it doesn''t seem to work. There is no other element by the same id. I did check it. But doesn''t seem to work. Adhiraj -- 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 -~----------~----~----~----~------~----~------~--~---
Adhiraj Rankhambe
2008-Jun-18 07:29 UTC
Re: In-page popup not supporting DOM structure/properties
Worked it out... I solved it out by using: render :update do |page| page.call(function, *arguments, &block) end http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html Cheers... Adhiraj -- 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 -~----------~----~----~----~------~----~------~--~---
Pragash Mr.
2008-Jun-18 09:15 UTC
Re: In-page popup not supporting DOM structure/properties
Adhiraj Rankhambe wrote:> In my current app, I have an in-page popup(those semi-transparent ones > like you find on Facebook) for login, which has only two fields: login > and password. > I am not able to set focus in the login field. > > document.getElementById(''element'').focus(); doesn''t seem to work. > document.getElementById(''element'') returns "null". > > I have a link for ''Login'' on the ''Home Page''. When user clicks on the > Login link, an in-page pop is rendered on the same page, so you can see > the ''Home Page'' in the background, but focus is on the ''Login popup''. > I think that''s because we have two layers of documents, one the ''Home > Page'' and second the ''Login'' popup''. So something wrong with the DOM > structure. Not sure... > > Does anyone know how to handle this situation? > > Thanks in advance > > AdhirajHi, in javascript function use like "document.forms[0].elements[0].focus()" -- 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 -~----------~----~----~----~------~----~------~--~---