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 %>
<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>
<%= _(‘Password’)
%>:
»" class="primary" />
<%= link_to "« " + _(‘Back to the blog’), { :controller
=> ‘/articles’ } %>
<% end %>
I want to give focus to the user_login field when the page loads. Any
ideas?
Thanks!