Skip to content

Commit

Permalink
Prevent the page to change when a validation error occurs on project_…
Browse files Browse the repository at this point in the history
…questions (#1134)
  • Loading branch information
jochenklar committed Sep 10, 2024
1 parent b1963de commit d8b788f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions rdmo/projects/static/projects/js/project_questions/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,8 +922,10 @@ angular.module('project_questions')
service.error = null; // reset error when moving to previous questionset
if (service.settings.project_questions_autosave) {
service.save(false, true).then(function() {
back = true;
service.initView(service.page.prev_page);
if (service.error === null) {
back = true;
service.initView(service.page.prev_page);
}
})
} else {
back = true;
Expand All @@ -935,7 +937,9 @@ angular.module('project_questions')
service.error = null; // reset error when moving to next questionset
if (service.settings.project_questions_autosave) {
service.save(false, true).then(function() {
service.initView(service.page.next_page);
if (service.error === null) {
service.initView(service.page.next_page);
}
})
} else {
service.initView(service.page.next_page);
Expand All @@ -946,8 +950,8 @@ angular.module('project_questions')
service.error = null; // reset error before saving
if (service.settings.project_questions_autosave) {
service.save(false, true).then(function() {
if (service.error !== null && service.error.status !== 400) {
// pass, dont jump (but not on a validation error)
if (service.error !== null) {
// pass, dont jump
} else if (angular.isDefined(page)) {
service.initView(page.id);
} else if (angular.isDefined(section)) {
Expand Down

0 comments on commit d8b788f

Please sign in to comment.