Skip to content

Commit

Permalink
Fix the wrong validation error message issue (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
KavinduGama authored Nov 23, 2024
1 parent eebbcf0 commit d81a17f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const MonthlyCheckInModal: React.FC<{
} = useForm<MenteeCheckInForm>({
resolver: zodResolver(MenteeCheckInSchema),
defaultValues: {
title: '',
month: '',
progressTowardsGoals: '',
generalUpdatesAndFeedback: '',
mediaContentLinks: [],
Expand Down Expand Up @@ -107,9 +107,9 @@ const MonthlyCheckInModal: React.FC<{
Select the month for which you are submitting the progress.
</p>
<select
{...register('title', { required: 'Month is required' })}
{...register('month', { required: 'Month is required' })}
className={`mt-1 block w-full border ${
errors.title ? 'border-red-500' : 'border-gray-300'
errors.month ? 'border-red-500' : 'border-gray-300'
} rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500`}
>
<option value="">Select a month</option>
Expand All @@ -119,9 +119,9 @@ const MonthlyCheckInModal: React.FC<{
</option>
))}
</select>
{errors.title && (
{errors.month && (
<p className="text-red-500 text-xs mt-1">
{errors.title.message}
{errors.month.message}
</p>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const MentorApplicationSchema = z.object({
});

export const MenteeCheckInSchema = z.object({
title: z.string().min(1, 'Title is required'),
month: z.string().min(1, 'Month is required'),
generalUpdatesAndFeedback: z
.string()
.min(5, 'Please provide general updates'),
Expand Down

0 comments on commit d81a17f

Please sign in to comment.