diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 82958f227..0d479ad41 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -11,6 +11,7 @@ class FormController < ApplicationController if mandatory_questions_with_no_response.empty? && @case_log.update(responses_for_page) session[:errors] = nil + session[:fields] = nil redirect_to(successful_redirect_path) else redirect_path = "case_log_#{@page.id}_path" diff --git a/spec/features/form/form_navigation_spec.rb b/spec/features/form/form_navigation_spec.rb index 579502426..d0ca551b4 100644 --- a/spec/features/form/form_navigation_spec.rb +++ b/spec/features/form/form_navigation_spec.rb @@ -139,7 +139,7 @@ RSpec.describe "Form Navigation" do context "when the page has a main and conditional question" do context "when the conditional question is required but not answered" do - it "shows a validation error for the conditional question", js: true do + it "shows a validation error for the conditional question" do visit("/logs/#{id}/armed-forces") choose("case-log-armedforces-1-field", allow_label_click: true) click_button("Save and continue")