fixed next and previous-step buttons for conditional questions on description editor

This commit is contained in:
Sofia Papacharalampous 2024-05-21 11:27:44 +03:00
parent 6facf9f7d4
commit 39e68bba77
1 changed files with 14 additions and 4 deletions

View File

@ -574,8 +574,13 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
if (this.step < this.maxStep) {//view is changing if (this.step < this.maxStep) {//view is changing
this.step = Math.floor(this.step + 1); this.step = Math.floor(this.step + 1);
let entry = this.visibleFieldSets[this.step - 1]; let entry = this.visibleFieldSets[this.step - 1];
const targetElement = document.getElementById(entry.id);
if (targetElement) {
this.table0fContents.onToCentrySelected(entry, false); this.table0fContents.onToCentrySelected(entry, false);
this.scroll(entry); this.scroll(entry);
} else {
this.nextStep();
}
} }
} }
@ -584,8 +589,13 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
this.step = Math.ceil(this.step - 1); this.step = Math.ceil(this.step - 1);
if (this.step >= 1) { if (this.step >= 1) {
let entry = this.visibleFieldSets[this.step - 1]; let entry = this.visibleFieldSets[this.step - 1];
const targetElement = document.getElementById(entry.id);
if (targetElement) {
this.table0fContents.onToCentrySelected(entry, false); this.table0fContents.onToCentrySelected(entry, false);
this.scroll(entry); this.scroll(entry);
} else {
this.previousStep();
}
} else { } else {
this.table0fContents.onToCentrySelected(null, false); this.table0fContents.onToCentrySelected(null, false);
this.resetScroll(); this.resetScroll();