Changelog: Update
[kivitendo-erp.git] / js / common.js
index 3a85529..43bb7de 100644 (file)
@@ -70,7 +70,7 @@ function check_right_date_format(input_name) {
     // 31122014 -> 12.04.2014
     // 12312014 -> 12/31/2014
     // 31122014 -> 31/12/2014
-    
+
     if (input_name.value.match(/^\d{8}$/)) {
       input_name.value = input_name.value.replace(/^(\d\d)(\d\d)(\d\d\d\d)$/, "$1" + seperator + "$2" + seperator + "$3")
     } else if (input_name.value.match(/^\d{6}$/)) {
@@ -90,7 +90,7 @@ function check_right_date_format(input_name) {
       var month = today.getMonth() + 1;
       var year = today.getYear();
       if( day.length == 1 && day < 10) {
-        day='0'+day; 
+        day='0'+day;
       };
       if(month<10) {
         month='0'+month;
@@ -100,7 +100,7 @@ function check_right_date_format(input_name) {
         input_name.value = day + seperator + month + seperator + year;
       } else {
         input_name.value = month + seperator + day + seperator + year;
-      } 
+      }
     };
   }
 
@@ -194,6 +194,10 @@ $(document).ready(function () {
     if (focussable(this)) window.focused_element = this;
   });
 
+  // Lowest priority: first focussable element in form.
+  set_cursor_to_first_element();
+
+  // Medium priority: class set in template
   var initial_focus = $(".initial_focus").filter(':visible')[0];
   if (initial_focus)
     $(initial_focus).focus();
@@ -201,7 +205,6 @@ $(document).ready(function () {
   // legacy. sone forms install these
   if (typeof fokus == 'function') { fokus(); return; }
   if (focus_by_name('cursor_fokus')) return;
-  set_cursor_to_first_element();
 });
 
 $('form').submit(function(){