Bug 21819: (QA follow-up) Replace onchange() in touched code
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 20 Nov 2018 15:32:46 +0000 (16:32 +0100)
committerJesse Maseto <jesse@bywatersolution.com>
Fri, 7 Dec 2018 21:38:47 +0000 (21:38 +0000)
AFAIK we should not call document...onchange() and assume that it works.
Apparently, it does at least in some browsers. But we are not sure.
We could easily replace them here by the documented jQuery counterpart.

Note: If you try git grep -l -E "onchange\(" you will find some
occurrences in two libraries and only in one js file (this one).
We should replace all occurrences here; will open a new report for that.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Verified that the change event was triggered: span should expand/collapse.

Signed-off-by: Andreas Roussos <arouss1980@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit aeaf74b7cc6608d7b81aaba10defdca6decdaa1d)

Signed-off-by: Jesse Maseto <jesse@bywatersolution.com>

koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js

index be5fe36..8b1d933 100644 (file)
@@ -250,11 +250,9 @@ function editAction( mmta_id, ordering, action, field_number, from_field, from_s
     document.getElementById('to_field').value = to_field;
     document.getElementById('to_subfield').value = to_subfield;
     if ( to_regex_search == '' && to_regex_replace == '' && to_regex_modifiers == '' ) {
-        document.getElementById('to_field_regex').checked = false;
-        document.getElementById('to_field_regex').onchange();
+        $('#to_field_regex').prop('checked', false).change();
     } else {
-        document.getElementById('to_field_regex').checked = true;
-        document.getElementById('to_field_regex').onchange();
+        $('#to_field_regex').prop('checked', true).change();
         $("#to_regex_search").val(to_regex_search);
         $("#to_regex_replace").val(to_regex_replace);
         $("#to_regex_modifiers").val(to_regex_modifiers);