Skip to content

Commit

Permalink
Feedback #226368 - [webapp] There is a need to remove the word limit …
Browse files Browse the repository at this point in the history
…in description form of Poll Creation.[keep minimum 10 words]
  • Loading branch information
sonaliTekdi committed Sep 4, 2024
1 parent 0e67b13 commit 7cad621
Showing 1 changed file with 26 additions and 19 deletions.
45 changes: 26 additions & 19 deletions packages/nulp_elite/src/pages/voting/createForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const createForm = () => {
const { state: editData } = location;
const [title, setTitle] = useState(editData?.title || "");
const [description, setDescription] = useState(editData?.description || "");
const [isDescriptionTouched, setIsDescriptionTouched] = useState(false);
const [pollType, setPollType] = useState([]);
const [startDate, setStartDate] = useState(
editData?.start_date ? dayjs(editData.start_date) : null
Expand Down Expand Up @@ -199,7 +200,8 @@ const [searchUser , setSearchUser]= useState("");
const isFormValid = () => {
return (
title.length >= 10 &&
description.length >= 100 &&
description.length >= 10 &&
description.length <= 100 &&
startDate !== null &&
endDate !== null
);
Expand Down Expand Up @@ -412,6 +414,11 @@ const [searchUser , setSearchUser]= useState("");
getOrgDetail(userData?.result?.response?.rootOrg?.id);
}
}, [isContentCreator, isAdmin, userData,searchUser]);

const handleDescriptionChange = (e) => {
setDescription(e.target.value);
setIsDescriptionTouched(true); // Mark the field as touched when the user types
};
return (
<div>
<Header globalSearchQuery={globalSearchQuery} />
Expand Down Expand Up @@ -467,24 +474,24 @@ const [searchUser , setSearchUser]= useState("");
: ""
}
/>
<TextField
label={
<span>
Description<span className="red"> *</span>
</span>
}
id="description"
multiline
rows={4}
className="mb-20"
value={description}
onChange={(e) => setDescription(e.target.value)}
error={description.length > 0 && description.length < 100}
helperText={
description.length > 0 && description.length < 100
? "Description must be at least 100 characters"
: ""
}
<TextField
label={
<span>
Description<span className="red"> *</span>
</span>
}
id="description"
multiline
rows={4}
className="mb-20"
value={description}
onChange={handleDescriptionChange}
error={isDescriptionTouched && (description.length < 10 || description.length > 100)}
helperText={
isDescriptionTouched && (description.length < 10 || description.length > 100)
? 'Description must be at least 10 characters and a maximum of 100 characters'
: ''
}
/>
<TextField
inputRef={inputRef}
Expand Down

0 comments on commit 7cad621

Please sign in to comment.