From 93916d6cde190a9763beaaa9076515444495ffce Mon Sep 17 00:00:00 2001 From: yash Date: Wed, 24 Jul 2024 17:24:47 +0530 Subject: [PATCH] Flash message and UI changes --- app/Http/Controllers/ResponseController.php | 6 +++--- resources/views/forms/create.blade.php | 2 +- resources/views/forms/edit.blade.php | 2 +- resources/views/forms/show.blade.php | 10 ++++++++++ resources/views/responses/showForm.blade.php | 6 +++--- vite.config.js | 10 ++++------ 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/ResponseController.php b/app/Http/Controllers/ResponseController.php index 60b1a59..6f6ee4b 100644 --- a/app/Http/Controllers/ResponseController.php +++ b/app/Http/Controllers/ResponseController.php @@ -118,13 +118,13 @@ class ResponseController extends Controller $validatedData = $request->validate([ - 'answers' => 'required|array', - 'answers.*' => 'required', + 'answers' => 'array', + 'answers.*' => '', ]); foreach ($requiredQuestionIds as $requiredQuestionId) { - if (!array_key_exists($requiredQuestionId, $validatedData['answers'])) { + if (!isset($validatedData['answers'][$requiredQuestionId]) || empty($validatedData['answers'][$requiredQuestionId])) { return redirect()->back() ->withErrors(['errors' => 'Please answer all required questions.']) ->withInput(); diff --git a/resources/views/forms/create.blade.php b/resources/views/forms/create.blade.php index 9d82daa..0f557f3 100644 --- a/resources/views/forms/create.blade.php +++ b/resources/views/forms/create.blade.php @@ -62,7 +62,7 @@ - +
diff --git a/resources/views/forms/edit.blade.php b/resources/views/forms/edit.blade.php index 56a540c..a31c7e2 100644 --- a/resources/views/forms/edit.blade.php +++ b/resources/views/forms/edit.blade.php @@ -21,7 +21,7 @@ -