Hi all, This is more a javascript question, but hope someone can help me here. I have the following code to show a login form using AJAX: page.replace_html "login-form",(render :partial => "login/login_top_form") page.replace_html "login_top_form_link", link_to_hide_top_login_form page.visual_effect(:appear,"login-form") page.delay(1) do page["user_email"].focus() end The code works well in FF and Opera, the field user_email gets the focus but in IE I get an error: "Can''t move focus to the control because is invisible, not enable, or of a type that does not accept the focus" I could get a solution to verify if the page["user_email"] can get the focus and ignore that behavior on IE, but I don''t know how. Another question: can I get the type of browser inside an RJS template? unfortunatly many people still use IE :( -- 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 -~----------~----~----~----~------~----~------~--~---
J. mp wrote:> Hi all, > > This is more a javascript question, but hope someone can help me here. > I have the following code to show a login form using AJAX: > > page.replace_html "login-form",(render :partial => > "login/login_top_form") > page.replace_html "login_top_form_link", link_to_hide_top_login_form > > page.visual_effect(:appear,"login-form") > > page.delay(1) do > page["user_email"].focus() > end > > The code works well in FF and Opera, the field user_email gets the focus > but in IE I get an error: > "Can''t move focus to the control because is invisible, not enable, or of > a type that does not accept the focus" > > I could get a solution to verify if the page["user_email"] can get the > focus and ignore that behavior on IE, but I don''t know how. > > Another question: can I get the type of browser inside an RJS template? > > unfortunatly many people still use IE :(Forget it. I''m really dumb :) I found out the problem. I was putting javascript code at the end of the partial rtml code to get the focus on the element :( 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 -~----------~----~----~----~------~----~------~--~---