From f0f6ecdbde87ecd07f8a37d498ee0dbf38ccbc54 Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 15 Nov 2010 05:23:56 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.open-ils.org/ILS/trunk@18731 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/cat/marcedit.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index add1cbca27..8c58021db6 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -710,6 +710,17 @@ function createMARCTextbox (element,attrs) { 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 () { -- 2.11.0