Bug 21867: Replace remaining document.element.onchange calls in marc_modification_tem...
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 20 Nov 2018 15:45:17 +0000 (16:45 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 19 Dec 2018 09:51:05 +0000 (10:51 +0100)
Replace onchange() by jQuery change().

Test plan:
Go to marc mod templates. Add, edit and delete. Check if works and no js
errors.
git grep -l -E "onchange\(" should not have occurrences outside lib.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Andreas Roussos <arouss1980@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jesse Maseto <jesse@bywatersolution.com>
(cherry picked from commit 99436fa499e6f08f4575a4135344a46aa0bb6a94)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

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

index 8b1d933..a41da8b 100644 (file)
@@ -240,7 +240,7 @@ function editAction( mmta_id, ordering, action, field_number, from_field, from_s
     document.getElementById('mmta_id').value = mmta_id;
 
     setSelectByValue( 'action', action );
-    document.getElementById('action').onchange();
+    $('#action').change();
 
     setSelectByValue( 'field_number', field_number );
 
@@ -259,13 +259,13 @@ function editAction( mmta_id, ordering, action, field_number, from_field, from_s
     }
 
     setSelectByValue( 'conditional', conditional );
-    document.getElementById('conditional').onchange();
+    $('#conditional').change();
 
     document.getElementById('conditional_field').value = conditional_field;
     document.getElementById('conditional_subfield').value = conditional_subfield;
 
     setSelectByValue( 'conditional_comparison', conditional_comparison );
-    document.getElementById('conditional_comparison').onchange();
+    $('#conditional_comparison').change();
 
     document.getElementById('conditional_value').value = conditional_value;
 
@@ -284,7 +284,7 @@ function cancelEditAction() {
     document.getElementById('mmta_id').value = '';
 
     setSelectByValue( 'action', 'delete_field' );
-    document.getElementById('action').onchange();
+    $('#action').change();
 
     document.getElementById('from_field').value = '';
     document.getElementById('from_subfield').value = '';
@@ -296,17 +296,16 @@ function cancelEditAction() {
     $("#to_regex_modifiers").val("");
     $("#description").val("");
 
-    document.getElementById('to_field_regex').checked = false;
-    document.getElementById('to_field_regex').onchange();
+    $('#to_field_regex').prop('checked', false).change();
 
     setSelectByValue( 'conditional', '' );
-    document.getElementById('conditional').onchange();
+    $('#conditional').change();
 
     document.getElementById('conditional_field').value = '';
     document.getElementById('conditional_subfield').value = '';
 
     setSelectByValue( 'conditional_comparison', '' );
-    document.getElementById('conditional_comparison').onchange();
+    $('#conditional_comparison').change();
 
     document.getElementById('conditional_value').value = '';