Fixes issue 18739: Business Partner selector overwrites first typed letter
authorMartin Taal <martin.taal@openbravo.com>
Wed, 12 Oct 2011 22:51:45 +0200
changeset 13963 b83c1fc7a6b8
parent 13962 6c0452815569
child 13964 c539e5866861
child 13965 cebb5684e24f
Fixes issue 18739: Business Partner selector overwrites first typed letter
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Wed Oct 12 22:51:25 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Wed Oct 12 22:51:45 2011 +0200
@@ -1593,9 +1593,20 @@
   // always suppress focus when showing errors, we do focus handling
   // explicitly
   showFieldErrors: function (fieldName, suppressAutoFocus) {
+    // temporary set selectonfocus to false
+    // until after the redraw, to prevent this issue
+    // https://issues.openbravo.com/view.php?id=18739
+    this.previousSelectOnFocus = this.selectOnFocus;
+    this.selectOnFocus = false;
     this.Super('showFieldErrors', [fieldName, true]);
   },
   
+  redraw: function() {
+    this.Super('redraw', arguments);
+    this.selectOnFocus = this.previousSelectOnFocus;
+    delete this.previousSelectOnFocus;
+  },
+  
   destroy: function () {
     var i, item, items = this.getItems(), len = items.length, 
       ds, dataSources = [];