-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tag-#77: From validation #83
tag-#77: From validation #83
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@MrBlackGhostt we know the error, kindly check the discord |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frontend/src/lib/blog.zod.ts
Outdated
}), | ||
authorName: z.string().refine((value) => value.trim().length >= 3 && value.trim().length <= 15, { | ||
message: 'Hey, Your name should be more than 5 letters.', | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use "your name should be" emphasis on should, becuase he can be Raj,
We can be like "C'mon your name cannot be less than 3 characters" ( if its less than 3 letters);
if greater than 15 say "Hey isn't it too big of a name, can you limit it to 15 characters" or improvise on this
}), | ||
categories: z.array(z.string()).refine((value) => value.length <= 3, { | ||
message: 'Easy there! Select up to 3 categories.', | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now I see the Sarcism here 😅
…ew msg according to the authorName lenght
…ew msg according to the authorName lenght
If we are not working on this anymore, kindly close this |
Summary
Use the React-hook-form and Zod for the form validation
Description
1.Install Dependencies:
First, make sure you have react-hook-form and zod installed. You can install them using npm or yarn:
2.Create Form Schema with Zod:
Define your form schema using Zod. This includes specifying the validation rules and error messages for each field.
3.Use New Dependencies:
use the React-hook-form & zod for the input and validation
Images
Before
After
Prerequisites