Hi, I am new to rails and I have setup Typo on my site. One little thing bugs me, the login page doesn''t give focus to the "user_login" field. I was wondering what do I need to do to make rails help with this? I have seen some simple inline javascript to set the focus, sort of like: document.<form_name>.user_login.focus() However the rails view doesn''t have name for the form, so that code won''t work. Below is the code for the login.rhtml from Typo: <% form_tag :action=> "login" do %> <div title="Account login" id="loginform"> <h3>Typo</h3> <div class="form admin"> <% if flash[:notice] %> <h4><%= flash[:notice] %></h4> <% end %> <ul> <li> <label for="user_login" class="block"><%= _(''Username'')%>:</ label> <input type="text" name="user_login" id="user_login" size="20" value=""/> </li> <li> <label for="user_password" class="block"><%= _(''Password'') %>:</label> <input type="password" name="user_password" id="user_password" size="30"/> </li> </ul> <input type="submit" name="login" value= "<%= _(''Login'') %> »" class="primary" /> <p><%= link_to "« " + _(''Back to the blog''), { :controller => ''/articles'' } %></p> </div> </div> <% end %> I want to give focus to the user_login field when the page loads. Any ideas? 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 -~----------~----~----~----~------~----~------~--~---
any one? On Aug 30, 8:44 pm, anoweb <codecr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > I am new to rails and I have setup Typo on my site. One little > thing bugs me, the login page doesn''t give focus to the "user_login" > field. I was wondering what do I need to do to make rails help with > this? I have seen some simple inline javascript to set the focus, > sort of like: > > document.<form_name>.user_login.focus() > > However the rails view doesn''t have name for the form, so that code > won''t work. Below is the code for the login.rhtml from Typo: > > <% form_tag :action=> "login" do %> > > <div title="Account login" id="loginform"> > > <h3>Typo</h3> > > <div class="form admin"> > <% if flash[:notice] %> > <h4><%= flash[:notice] %></h4> > <% end %> > <ul> > <li> > <label for="user_login" class="block"><%= _(''Username'')%>:</ > label> > <input type="text" name="user_login" id="user_login" > size="20" value=""/> > </li> > <li> > <label for="user_password" class="block"><%= _(''Password'') > %>:</label> > <input type="password" name="user_password" > id="user_password" size="30"/> > </li> > </ul> > <input type="submit" name="login" value= "<%= _(''Login'') %> > »" class="primary" /> > <p><%= link_to "« " + _(''Back to the blog''), { :controller > => ''/articles'' } %></p> > </div> > </div> > > <% end %> > > I want to give focus to the user_login field when the page loads. Any > ideas? > > 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 -~----------~----~----~----~------~----~------~--~---
found the answer elsewhere: http://railsforum.com/viewtopic.php?pid=19180#p19180 On Aug 31, 5:06 am, anoweb <codecr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> any one? > > On Aug 30, 8:44 pm, anoweb <codecr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi, > > I am new to rails and I have setup Typo on my site. One little > > thing bugs me, the login page doesn''t give focus to the "user_login" > > field. I was wondering what do I need to do to make rails help with > > this? I have seen some simple inline javascript to set the focus, > > sort of like: > > > document.<form_name>.user_login.focus() > > > However the rails view doesn''t have name for the form, so that code > > won''t work. Below is the code for the login.rhtml from Typo: > > > <% form_tag :action=> "login" do %> > > > <div title="Account login" id="loginform"> > > > <h3>Typo</h3> > > > <div class="form admin"> > > <% if flash[:notice] %> > > <h4><%= flash[:notice] %></h4> > > <% end %> > > <ul> > > <li> > > <label for="user_login" class="block"><%= _(''Username'')%>:</ > > label> > > <input type="text" name="user_login" id="user_login" > > size="20" value=""/> > > </li> > > <li> > > <label for="user_password" class="block"><%= _(''Password'') > > %>:</label> > > <input type="password" name="user_password" > > id="user_password" size="30"/> > > </li> > > </ul> > > <input type="submit" name="login" value= "<%= _(''Login'') %> > > »" class="primary" /> > > <p><%= link_to "« " + _(''Back to the blog''), { :controller > > => ''/articles'' } %></p> > > </div> > > </div> > > > <% end %> > > > I want to give focus to the user_login field when the page loads. Any > > ideas? > > > Thanks!- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---