From 44e4ab6d4707286d206f9749434e01f8073e1d3e Mon Sep 17 00:00:00 2001 From: stonebuzz Date: Fri, 31 Mar 2023 09:30:57 +0200 Subject: [PATCH] fix(FormAnswer): redirect to FormAnswer or to list if needed --- front/formanswer.form.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/front/formanswer.form.php b/front/formanswer.form.php index 99b8fa5f6..71795854f 100644 --- a/front/formanswer.form.php +++ b/front/formanswer.form.php @@ -45,14 +45,13 @@ $formanswer->update($_POST); Html::back(); -} else if (isset($_POST['refuse_formanswer'])) { - $formanswer->update($_POST); - $formanswer->redirectToList(); - -} else if (isset($_POST['accept_formanswer'])) { - $formanswer->update($_POST); - $formanswer->redirectToList(); - +} else if (isset($_POST['refuse_formanswer']) || isset($_POST['accept_formanswer'])) { + if ($formanswer->update($_POST)) { + $formanswer->redirectToList(); + }else{ + //redirect to formanswer if update failed (ex : missing mandatory field) + Html::back(); + } } else if (isset($_POST['save_formanswer'])) { if (!$formanswer->update($_POST)) { Html::back();