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')%>:</
<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!