From ba36fc3ebe108ed3548692da5370a0f046301a94 Mon Sep 17 00:00:00 2001 From: Michael Seaton Date: Mon, 30 Sep 2024 09:50:00 -0400 Subject: [PATCH] RA-2047 - Registration app personAddressWithHierarchy does not navigate correctly when there are no free-text levels (#144) --- .../field/personAddressWithHierarchy.js | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/omod/src/main/webapp/resources/scripts/field/personAddressWithHierarchy.js b/omod/src/main/webapp/resources/scripts/field/personAddressWithHierarchy.js index 4faad3a2..f406d72a 100644 --- a/omod/src/main/webapp/resources/scripts/field/personAddressWithHierarchy.js +++ b/omod/src/main/webapp/resources/scripts/field/personAddressWithHierarchy.js @@ -318,27 +318,32 @@ function PersonAddressWithHierarchy(personAddressWithHierarchy) { }); _.each(ui.item.data, function (value, key) { setValue(key, value); + if (typeof (NavigatorController) != 'undefined') { + NavigatorController.stepForward(); + } }); - // go to the first level we didn't just set + // go to the first level we didn't just set if there is one defined var goToLevel = firstLevelNotIncluded(ui.item.data); - //this will disable next mandatory levels if no entries are configured in the system - preloadLevels(goToLevel); + if (goToLevel) { + //this will disable next mandatory levels if no entries are configured in the system + preloadLevels(goToLevel); - // if we are using the simple UI navigator, use the NavigatorController so that the simple for UI keeps up - if (typeof(NavigatorController) != 'undefined') { - var field = NavigatorController.getFieldById(personAddressWithHierarchy.id + '-' + goToLevel.addressField); - setTimeout(function () { - var oldField = selectedModel(NavigatorController.getFields()); - if (oldField) { - oldField.toggleSelection(); - } - field.select(); - }); - } - // otherwise just jump manually - else { - getInputElementFor(goToLevel.addressField).focus(); + // if we are using the simple UI navigator, use the NavigatorController so that the simple for UI keeps up + if (typeof (NavigatorController) != 'undefined') { + var field = NavigatorController.getFieldById(personAddressWithHierarchy.id + '-' + goToLevel.addressField); + setTimeout(function () { + var oldField = selectedModel(NavigatorController.getFields()); + if (oldField) { + oldField.toggleSelection(); + } + field.select(); + }); + } + // otherwise just jump manually + else { + getInputElementFor(goToLevel.addressField).focus(); + } } }, change: function (event, ui) {