Bugzilla – Attachment 34138 Details for
Bug 13391
MARC 008 builder plugin not compatible with browser autocompletion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13391 - MARC 008 builder plugin not compatible with browser autocompletion
Bug-13391---MARC-008-builder-plugin-not-compatible.patch (text/plain), 4.68 KB, created by
Jacek Ablewicz
on 2014-12-05 11:29:49 UTC
(
hide
)
Description:
Bug 13391 - MARC 008 builder plugin not compatible with browser autocompletion
Filename:
MIME Type:
Creator:
Jacek Ablewicz
Created:
2014-12-05 11:29:49 UTC
Size:
4.68 KB
patch
obsolete
>From c15b176efd072e3feb0fac436c8b1a4953d325cf Mon Sep 17 00:00:00 2001 >From: Jacek Ablewicz <abl@biblos.pk.edu.pl> >Date: Fri, 5 Dec 2014 11:36:49 +0100 >Subject: [PATCH] Bug 13391 - MARC 008 builder plugin not compatible with > browser autocompletion > >In the koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js >(currently used by 006 and 008 MARC21 plugins), in line 317 there >are two JS events (onkeyup and onfocus) associated with <input> fields. >But there is a slight problem with onkeyup event handler, apparently >this event does not fire when: > >- user starts to enter some characters using the keyboard, >- and then chooses something from the autocompletion list offered by browser. > >In such circumstances only the first character[s] entered in the given >field are saved in 006 and/or 008 (only the part that was typed on the >keyboard), and the remaining characters are effectively being ignored. > >This patch adds two additional event handlers to the <input> fields >generated by the renderPositions() function in xmlControlfield.js: >oninput (that should completely solve the problem for recent, >HTML5-compliant browsers) and onblur (that, while not being quite >satisfactory solution, should at least somehow improve things >for old/lagacy WWW browsers as well). > >To test: > >- reproduce the aforementioned issue (try to enter some data into >e.g. "country code" / 15-17 positions in the 008 MARC21 plugin: first >using only the keyboard, and then by the means of the browser autocomplete) >- observe that when the value is choosen from the autocompletion list, >only the 1st part of it is being stored in the respective 008 field >positions on the top >- apply patch >- clear browser cache >- retest (preferably using some modern WWW browser first, and then >something much older and inherently broken like IE7 or IE8 etc.) >- make sure there are no aparent regresions of any kinds regarding >006 and 008 MARC21 plugins behaviour. >--- > koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js >index d995bda..14c1bb7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js >@@ -314,7 +314,8 @@ function changeH4Result(form, h4_result, tr_result, pos, value) > var ini = parseInt(pos.substring(0, index) ,10); > var end = parseInt(pos.substr(index + 1) ,10); > value = value.replace(/ /g, "#"); >- strInnerHTML = "<input type='text' name='f" + pos + "' id='f" + pos + "' value='" + value + "' size='" + (1 + end - ini) + "' maxlength='" + (1 + end - ini) + "' onkeyup='this.value = this.value.replace(/ /g, \"#\"); changeH4Result(document.getElementById(\"" + this.form_id + "\"), document.getElementById(\"" + this.h4_result + "\"), document.getElementById(\"" + this.tr_result + "\"), \"" + pos + "\", this.value)' onfocus='changeH4Result(document.getElementById(\"" + this.form_id + "\"), document.getElementById(\"" + this.h4_result + "\"), document.getElementById(\"" + this.tr_result + "\"), \"" + pos + "\", this.value)' />"; >+ var event_str = "'this.value = this.value.replace(/ /g, \"#\"); changeH4Result(document.getElementById(\"" + this.form_id + "\"), document.getElementById(\"" + this.h4_result + "\"), document.getElementById(\"" + this.tr_result + "\"), \"" + pos + "\", this.value)'"; >+ strInnerHTML = "<input type='text' name='f" + pos + "' id='f" + pos + "' value='" + value + "' size='" + (1 + end - ini) + "' maxlength='" + (1 + end - ini) + "' onkeyup=" + event_str + " oninput=" + event_str + " onblur=" + event_str + " onfocus='changeH4Result(document.getElementById(\"" + this.form_id + "\"), document.getElementById(\"" + this.h4_result + "\"), document.getElementById(\"" + this.tr_result + "\"), \"" + pos + "\", this.value)' />"; > } else { > strInnerHTML = "<select name='f" + pos + "' id='f" + pos + "' style='width:400px' onchange='changeH4Result(document.getElementById(\"" + this.form_id + "\"), document.getElementById(\"" + this.h4_result + "\"), document.getElementById(\"" + this.tr_result + "\"), \"" + pos + "\", this.options[this.selectedIndex].value)' onfocus='changeH4Result(document.getElementById(\"" + this.form_id + "\"), document.getElementById(\"" + this.h4_result + "\"), document.getElementById(\"" + this.tr_result + "\"), \"" + pos + "\", this.options[this.selectedIndex].value)'>"; > value = value.replace("#", " "); >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13391
: 34138