Skip to content

Commit 3ca37b7

Browse files
authored
fix: validate max number of poll votes based on input validity (#2701)
Show field error for numeric field with incorrect input.
1 parent daacc4f commit 3ca37b7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/Poll/PollCreationDialog/PollCreationDialog.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ export const PollCreationDialog = ({ close }: PollCreationDialogProps) => {
123123
id='max_votes_allowed'
124124
onChange={(e) => {
125125
const isValidValue =
126-
!e.target.value ||
127-
e.target.value.match(VALID_MAX_VOTES_VALUE_REGEX);
126+
e.target.validity.valid &&
127+
(!e.target.value ||
128+
e.target.value.match(VALID_MAX_VOTES_VALUE_REGEX));
128129
if (!isValidValue) {
129130
setMultipleAnswerCountError(
130131
t<string>('Type a number from 2 to 10'),

0 commit comments

Comments
 (0)