introduce class 'autofocus' which sets the focus on the first

element that has this class
pull/41/head
Romano Licker 13 years ago
parent 1d44ca87ce
commit d3d7d43cb5
  1. 10
      public/javascripts/application.js

@ -461,9 +461,13 @@ function addClickEventToAllErrorMessages() {
}
$(document).observe('dom:loaded', function() {
// Set focus on first error message
var focus = $$('a.afocus').first();
if (focus != undefined) {
focus.focus();
var error_focus = $$('a.afocus').first();
var input_focus = $$('.autofocus').first();
if (error_focus != undefined) {
error_focus.focus();
}
else if (input_focus != undefined){
input_focus.focus();
}
// Focus on field with error
addClickEventToAllErrorMessages();

Loading…
Cancel
Save