From 82bcc0ae7e7ddcb1efd7b9a91a7b935dd4ab88e9 Mon Sep 17 00:00:00 2001 From: Meet Patel Date: Wed, 5 Jul 2023 20:41:48 +0530 Subject: [PATCH 1/2] space not allowed in questionid input --- .../surveys/[surveyId]/edit/UpdateQuestionId.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/UpdateQuestionId.tsx b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/UpdateQuestionId.tsx index a4fe4ab0ce..8f7d886f0f 100644 --- a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/UpdateQuestionId.tsx +++ b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/UpdateQuestionId.tsx @@ -30,13 +30,14 @@ export default function UpdateQuestionId({ localSurvey, question, questionIdx, u value={currentValue} onChange={(e) => setCurrentValue(e.target.value)} disabled={localSurvey.status !== "draft"} + className={currentValue.includes(" ") ? "focus:border-red-300 border-red-300" : ""} /> {localSurvey.status === "draft" && ( )} From 4cc085cecfe2481a482ddc40456ab41fe240c6b7 Mon Sep 17 00:00:00 2001 From: Meet Patel Date: Thu, 6 Jul 2023 21:46:31 +0530 Subject: [PATCH 2/2] questionid can not be empty --- .../surveys/[surveyId]/edit/UpdateQuestionId.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/UpdateQuestionId.tsx b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/UpdateQuestionId.tsx index 8f7d886f0f..2ff269be8c 100644 --- a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/UpdateQuestionId.tsx +++ b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/UpdateQuestionId.tsx @@ -20,6 +20,8 @@ export default function UpdateQuestionId({ localSurvey, question, questionIdx, u toast.success("Question ID updated."); }; + const isInputInvalid = currentValue.trim() === "" || currentValue.includes(" "); + return (
@@ -30,14 +32,14 @@ export default function UpdateQuestionId({ localSurvey, question, questionIdx, u value={currentValue} onChange={(e) => setCurrentValue(e.target.value)} disabled={localSurvey.status !== "draft"} - className={currentValue.includes(" ") ? "focus:border-red-300 border-red-300" : ""} + className={isInputInvalid ? "focus:border-red-300 border-red-300" : ""} /> {localSurvey.status === "draft" && ( )}