From 1fafd32aaf4f7f7c9694eb034baa4bc135e4848d Mon Sep 17 00:00:00 2001 From: Akosh Pinter Date: Wed, 4 Aug 2021 17:06:40 +0200 Subject: [PATCH] Possible fix for the chore & battery dropdown clearing issue - #1560 (#1561) * Possible fix for the chore & battery dropdown clearing issue - #1560 * Revert formatting changes - #1560 Co-authored-by: Akos Pinter --- public/viewjs/batterytracking.js | 27 ++++++++++++++------------- public/viewjs/choretracking.js | 26 +++++++++++++------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/public/viewjs/batterytracking.js b/public/viewjs/batterytracking.js index a0633ce1..f410fc74 100644 --- a/public/viewjs/batterytracking.js +++ b/public/viewjs/batterytracking.js @@ -140,19 +140,20 @@ $('#battery_id_text_input').on('blur', function(e) { possibleOptionElement = $("#battery_id option[value=\"" + gc[2] + "\"]").first(); } - } - if (possibleOptionElement.length > 0) - { - $('#battery_id').val(possibleOptionElement.val()); - $('#battery_id').data('combobox').refresh(); - $('#battery_id').trigger('change'); - } - else - { - $('#battery_id').val(null); - $('#battery_id_text_input').val(""); - $('#battery_id').data('combobox').refresh(); - $('#battery_id').trigger('change'); + + if (possibleOptionElement.length > 0) + { + $('#battery_id').val(possibleOptionElement.val()); + $('#battery_id').data('combobox').refresh(); + $('#battery_id').trigger('change'); + } + else + { + $('#battery_id').val(null); + $('#battery_id_text_input').val(""); + $('#battery_id').data('combobox').refresh(); + $('#battery_id').trigger('change'); + } } }); diff --git a/public/viewjs/choretracking.js b/public/viewjs/choretracking.js index 64435ed8..6cc3d286 100644 --- a/public/viewjs/choretracking.js +++ b/public/viewjs/choretracking.js @@ -161,19 +161,19 @@ $('#chore_id_text_input').on('blur', function(e) { possibleOptionElement = $("#chore_id option[value=\"" + gc[2] + "\"]").first(); } - } - if (possibleOptionElement.length > 0) - { - $('#chore_id').val(possibleOptionElement.val()); - $('#chore_id').data('combobox').refresh(); - $('#chore_id').trigger('change'); - } - else - { - $('#chore_id').val(null); - $('#chore_id_text_input').val(""); - $('#chore_id').data('combobox').refresh(); - $('#chore_id').trigger('change'); + if (possibleOptionElement.length > 0) + { + $('#chore_id').val(possibleOptionElement.val()); + $('#chore_id').data('combobox').refresh(); + $('#chore_id').trigger('change'); + } + else + { + $('#chore_id').val(null); + $('#chore_id_text_input').val(""); + $('#chore_id').data('combobox').refresh(); + $('#chore_id').trigger('change'); + } } });