Skip to content
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

Refactor Form vailidation using the react-hook-form and zod #77

Closed
geetanjalichawla opened this issue Dec 12, 2023 · 27 comments · Fixed by #407
Closed

Refactor Form vailidation using the react-hook-form and zod #77

geetanjalichawla opened this issue Dec 12, 2023 · 27 comments · Fixed by #407
Labels
enhancement Enhancement to the existing code gssoc Issue can be taken under GSSoC level2

Comments

@geetanjalichawla
Copy link
Contributor

geetanjalichawla commented Dec 12, 2023

Description

  1. Getting values in and out of form state
  2. Validation and error messages
  3. Handling form submission

we can use formik or useform library for the validation

why Formik ?

Formik keeps track of your form's state and then exposes it plus a few reusable methods and event handlers (handleChange, handleBlur, and handleSubmit) to your form via props

Formik and useForm are the mostly used library and it can handle a lot of things very good for learning prospective also

Current Behavior

  1. There are no validation of the title of the post like there should be minimum 3 char for the title.
  2. There are no validation for the author name which maybe we can handle with the authentication but still it should have minimum '3 character in a author name '
  3. Required error is not shown before clicking on the submit Button

Proposed Enhancement

The validation help us to post the right type of data in the blog post we need also can reduce the chances of wrong and trash data by adding some validation like if we want email then this should have some patter text@domain-name.topleveldomain like in,co,com etc

Attachment

image

@geetanjalichawla geetanjalichawla added the enhancement Enhancement to the existing code label Dec 12, 2023
@MrBlackGhostt
Copy link

@geetanjalichawla

I've gained expertise in React and would love to contribute to the project. I've identified form validation issue #77 and am eager to resolve it. Could you please assign this issue to me? I'm committed to delivering a solution aligned with project standards.

@geetanjalichawla
Copy link
Contributor Author

@krishnaacharyaa

@MrBlackGhostt
Copy link

@krishnaacharyaa can you assign me this issue #77

@krishnaacharyaa
Copy link
Owner

@MrBlackGhostt, how are you going to solve the issue and kindly give me time estimate

@MrBlackGhostt
Copy link

installed the formik library and it tells the title should be 3 min char so I use the validate. length > 3 by doing so it will validate

@krishnaacharyaa
Copy link
Owner

@geetanjalichawla @MrBlackGhostt,
I believe for our project we can work on react hook with zod form instead of formik.
Kindly refer: https://youtu.be/u6PQ5xZAv7Q?feature=shared

@MrBlackGhostt, let me know if you are confident to take this up, it is a little task intensive in my opinion, you can take up others issues as well to start from

@MrBlackGhostt
Copy link

@krishnaacharyaa I am confident that I can take the issue and solve it

@krishnaacharyaa
Copy link
Owner

Okay @MrBlackGhostt assigning it to you, follow the YouTube link as above and make the required changes ...
Let's stick to react hooks + zod with server side errors

@MrBlackGhostt
Copy link

@krishnaacharyaa
put the validation on the blog title and author name can you please check it

12.07.41.PM.mov

@krishnaacharyaa
Copy link
Owner

Let's discuss on the Discord channel, that's convenient for both of us

@MrBlackGhostt
Copy link

don't find the discord channel link in your profile it only Twitter StackOverflow LinkedIn, not discord

@krishnaacharyaa
Copy link
Owner

In project readme

@MrBlackGhostt
Copy link

join the Discord server i am read to discuss

@MrBlackGhostt
Copy link

MrBlackGhostt commented Dec 14, 2023

Screen.Recording.2023-12-14.at.6.16.18.PM.mov

@krishnaacharyaa now error shows on clicking the button if the word on either author or title or both its show the message below the input also add the margin-top the error show last is because i don't run the mongo not its run perfectly please check

@krishnaacharyaa
Copy link
Owner

@MrBlackGhostt great improvement, thank you for the quick fix, just a couple of observations, let's kindly discuss in the discord.

@MrBlackGhostt
Copy link

@krishnaacharyaa In discord server I uploaded a video of Form plz check it.

MrBlackGhostt pushed a commit to MrBlackGhostt/wanderlust that referenced this issue Dec 15, 2023
MrBlackGhostt pushed a commit to MrBlackGhostt/wanderlust that referenced this issue Dec 15, 2023
MrBlackGhostt pushed a commit to MrBlackGhostt/wanderlust that referenced this issue Dec 15, 2023
MrBlackGhostt pushed a commit to MrBlackGhostt/wanderlust that referenced this issue Dec 15, 2023
MrBlackGhostt pushed a commit to MrBlackGhostt/wanderlust that referenced this issue Dec 15, 2023
MrBlackGhostt pushed a commit to MrBlackGhostt/wanderlust that referenced this issue Dec 15, 2023
@krishnaacharyaa
Copy link
Owner

@MrBlackGhostt, kindly follow this style of commit message and PR title: #67

MrBlackGhostt pushed a commit to MrBlackGhostt/wanderlust that referenced this issue Dec 15, 2023
MrBlackGhostt pushed a commit to MrBlackGhostt/wanderlust that referenced this issue Dec 15, 2023
@krishnaacharyaa
Copy link
Owner

@MrBlackGhostt , Do you wanna finish this? It is almost 80% done to be honest... @geetanjalichawla if you find it interesting, can you just kindly work with him, so that we can close this....

@MrBlackGhostt
Copy link

yes

@krishnaacharyaa
Copy link
Owner

@MrBlackGhostt please work on the comments, as far as i remember, the added functionalities were working just perfect, but it was breaking the exisiting features, Can you add one by one validation , so that you get a grip and can succesfully finish this, Feel free to take help from the discord.

@krishnaacharyaa
Copy link
Owner

@MrBlackGhostt kindly confirm.... Else will try deligating it.... If you have other priority work....

@MrBlackGhostt
Copy link

Sorry @krishnaacharyaa I am little busy i love to contribute but did not make the time

@krishnaacharyaa krishnaacharyaa changed the title Form vailidation Refactor Form vailidation using the react-hook-form and zod Mar 17, 2024
@devsharmagit
Copy link
Contributor

so @krishnaacharyaa this is not finished yet?

@krishnaacharyaa
Copy link
Owner

I am not hearing from the guy who was working.
You can start this, And kindly raise PR with commit and PR guidelines.
I had to decline a PR because of it, as warned 2 times :) @devsharmagit

@devsharmagit
Copy link
Contributor

@krishnaacharyaa
okay, I will check and see what has been implemented and whats needs to be added.

@ShristiSharan
Copy link

I'm interested to work upon it.
@krishnaacharyaa Kindly assign this task to me.

@krishnaacharyaa krishnaacharyaa added gssoc Issue can be taken under GSSoC level2 labels May 12, 2024
@krishnaacharyaa
Copy link
Owner

@ShristiSharan can you kindly let us what is the update, if you are inactive, someone else will take it.
Will wait for another day for the reply.

@ShristiSharan ShristiSharan removed their assignment May 30, 2024
ShristiSharan added a commit to ShristiSharan/Wanderlust-gssoc that referenced this issue Jun 1, 2024
ShristiSharan added a commit to ShristiSharan/Wanderlust-gssoc that referenced this issue Jun 1, 2024
Ameerjafar added a commit to Ameerjafar/wanderlust that referenced this issue Jun 7, 2024
Ameerjafar added a commit to Ameerjafar/wanderlust that referenced this issue Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment