[open-ils-commits] r18732 - branches/rel_2_0/Open-ILS/xul/staff_client/server/cat (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Nov 15 00:24:41 EST 2010


Author: dbs
Date: 2010-11-15 00:24:38 -0500 (Mon, 15 Nov 2010)
New Revision: 18732

Modified:
   branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
Prevent creation of authority records that are truncated by one letter

The summarizeField() function grabbed the values of the XUL elements,
which were set by the keypress event listeners on the XUL elements.
However, the keypress event listener seems to capture the value of
the XUL element before the value of the new key is appended to the
existing value in a textbox - so, when you typed a new subfield, then
right-clicked to create an authority, the value that was captured was
missing the final character.

Adding the "input" event to the registered listeners captures the
actual value for creating an authority and solves the problem. It
might be possible to remove the keypress event listeners, but for
now we'll take the cautious route.

Address Launchpad bug 669445


Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-11-15 05:23:56 UTC (rev 18731)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-11-15 05:24:38 UTC (rev 18732)
@@ -710,7 +710,18 @@
         true
     );
 
+    // 'input' event catches the box value after the keypress
     box.addEventListener(
+        'input', 
+        function () {
+            if (element.nodeKind() == 'attribute') element[0]=box.value;
+            else element.setChildren( box.value );
+            return true;
+        },
+        true
+    );
+
+    box.addEventListener(
         'keyup', 
         function () {
             if (element.localName() == 'controlfield')



More information about the open-ils-commits mailing list