Next JS forms with Shadcn UI (the EASY way)

  Рет қаралды 52,083

WebDevEducation

WebDevEducation

Күн бұрын

Пікірлер: 101
@WebDevEducation
@WebDevEducation Жыл бұрын
I was sick when recording this so do me a favour and give the video a thumbs up 👍😂
@dreamsachiever212
@dreamsachiever212 Жыл бұрын
haha, I gave it a thumps up
@WebDevEducation
@WebDevEducation Жыл бұрын
@@dreamsachiever212 thank you sir! 😊
@molomekeys3938
@molomekeys3938 Жыл бұрын
nevermind it's a wonderful vidoe thank you sir
@bhavyakothari635
@bhavyakothari635 Жыл бұрын
Definitely mate. What a great video and the way you quickly explained it. No BS just pinpointed. Great video man. +Subscribed.
@rembautimes8808
@rembautimes8808 5 ай бұрын
I have a thumbs up though I code in Angular and use Angular Material. Would ShadCN make a good kids name though 😂?
@eric_so_good
@eric_so_good Жыл бұрын
hey man i just went back after realized I haven't thank you about how straight forward this was! Thank you.
@arihantkamde9985
@arihantkamde9985 3 ай бұрын
Thanks for making this concept crystal clear.
@unnikuttan9637
@unnikuttan9637 Ай бұрын
Best video in youtube about form validation of shadcn.
@WebDevEducation
@WebDevEducation Ай бұрын
🙏
@shrikant124
@shrikant124 7 ай бұрын
Finally I found best video on Shadcn forms, thank you so much ❤
@WebDevEducation
@WebDevEducation 7 ай бұрын
🙏
@mohdali-yq8gq
@mohdali-yq8gq Жыл бұрын
I am really thankful for your consideration and hope that in near future you will bring the full stack course in next js sometime like ecommerce or expenses tracker or something like LinkedIn or anything you like where more and more concepts of front end and backend are covered.
@AnsgarSteinkamp
@AnsgarSteinkamp 7 ай бұрын
Brilliant tutorial, explained really well - thanks a lot! Hands down the top guide for shadcn and forms out there!
@davebeauchemin1080
@davebeauchemin1080 2 ай бұрын
Thank you so much for the explanation! Now it’s clear
@WebDevEducation
@WebDevEducation 2 ай бұрын
🙏
@naylord5
@naylord5 Жыл бұрын
Thank you so much for sharing mate! I hope you get well very soon 🙌🙌
@WebDevEducation
@WebDevEducation Жыл бұрын
You're welcome man and thank you 😊🙏
@rikisyahputra3805
@rikisyahputra3805 9 ай бұрын
When you set the account-type to 'company' and fill in the company name field, and then change the account-type to 'personal', and then submit the form, the company-name will still be logged in the console, even though the account-type is already changed to 'personal' and the company-name field is no longer exist. This is probably not a problem on most use-case, but I think this is worth noting.
@DiogoScarmagnani
@DiogoScarmagnani 4 ай бұрын
I think it happens to give a better experience to the user if the select is changed by mistake. This way, when the right option is also picked, the previous company value is still there. I agree that it could be removed after submitted but we must also validate it in backend at all, then...
@rikisyahputra3805
@rikisyahputra3805 4 ай бұрын
@@DiogoScarmagnani Yeah, I agree.
@Adrian_Galilea
@Adrian_Galilea Жыл бұрын
Fantastic video, appreciate that you drop the code too. I think if you now went ahead and you did a part 2 implementing this with next-safe-actions and server validation you'd have a very robust modern implementation. It's how I implemented it and there's 0 content available for the full example.
@prapathsuayroop2341
@prapathsuayroop2341 11 ай бұрын
Thank you very much for your effort to make a good explanation of the great content, It made I've more understanding in the Next JS form., finally subscribed and planned to get your course of NextJS on Udemy as well.
@WebDevEducation
@WebDevEducation 11 ай бұрын
Thank you 🙏 my next js courses on udemy are still using the pages router at the moment but I'm working on updating them all to use the app router 🙏
@oussamazerroug8171
@oussamazerroug8171 10 ай бұрын
Amazing it's exactly what I was looking for ❤
@jamesblake80
@jamesblake80 5 ай бұрын
Amazing video thanks! Made it really simple :)
@kareememad2195
@kareememad2195 4 ай бұрын
great work , thank you so much ❤❤
@ervczek
@ervczek 9 ай бұрын
Hi! Thank you so much for the tutorial, it's been very helpful for me as I'm currently building my first project using shadcn :) Will you also make a tutorial on using something like nodemailer to build on top of this example, so the contact form can be sent to an external email address?
@froggysan5203
@froggysan5203 11 ай бұрын
Thanks a lot i am in the process of making my first react project and i looked everywhere for some good docs that explain how to make a custom validation and i couldn't find any, but you are not only showing us how, you are also explaining it step by step which is great for people like me who's first language isn't English, thanks a ton, also just a request can you show us how to upload more than one image file with typescript too? Thanks
@ibrahimcious
@ibrahimcious Жыл бұрын
What a great explanation! Subscribed!
@WebDevEducation
@WebDevEducation Жыл бұрын
Thank you 😊 🙏
@nonada2251
@nonada2251 Жыл бұрын
Thank you very much, I finally managed to understand how to use these tools :)
@buraxta_
@buraxta_ Жыл бұрын
it's so clear and useful. thank you
@tsykin
@tsykin 7 ай бұрын
Thank you so much for suc a clear explanation!
@DiogoScarmagnani
@DiogoScarmagnani 4 ай бұрын
Very helpful video, thank you for it.
@mayankkhetan702
@mayankkhetan702 4 ай бұрын
nice explaination sir !!
@bobbyboxer2664
@bobbyboxer2664 8 ай бұрын
Amazing video! Thank you so much 🙏🏼
@AddictedGamerr
@AddictedGamerr 8 ай бұрын
Love it straight to point but i make a vidoe with phn field with all the country code and validation
@ktrifon
@ktrifon 3 ай бұрын
Excellent!!! Thank you very much!!!
@benlahrechislam7611
@benlahrechislam7611 6 ай бұрын
Great one sir, thank you!
@chinmayghule8272
@chinmayghule8272 10 ай бұрын
There are quite a few videos on shadcn on KZbin but none of them go deep and show how some of the complex shadcn components are to be used, like Form for example. I hope you also do a video on the DatePicker shadcn component as well. It seems to have a problem regarding manually typing dates. For example if you want to select your birth date, then you'll have to click a lot of times to get to your birth year.
@WebDevEducation
@WebDevEducation 10 ай бұрын
Already covered that in my shadcn ui calendar video 😊🙏
@cesarquispe2413
@cesarquispe2413 8 ай бұрын
Hey great video! I was wondering how did you know where to "insert" the FormControl component in between the Select component anatomy? I've been working on the Combobox component and trying to make it work in a form. I've done a first version of it but yours with the Select seems cleaner.
@Lone-Tuna
@Lone-Tuna 5 ай бұрын
How to pass the values to server actions?
@ayushjhabak2851
@ayushjhabak2851 7 ай бұрын
how to set default value in shadcn select ?
@ONEOTPOfficial
@ONEOTPOfficial 9 ай бұрын
it was really very helpfull man
@debarshidas8678
@debarshidas8678 9 ай бұрын
Thanks man! ♥
@SanthoshRaghav-m1x
@SanthoshRaghav-m1x 9 ай бұрын
Hi Tom Philips I tested this form, it is rendering multiple times unnecessarily including “render” prop method and also entire component(page.tsx). When we use “react-hook-form” it manages form state internally, but here re-renders happening on every keystroke. Could please help me how to avoid unnecessary re-renders?
@coolcubestudio
@coolcubestudio Жыл бұрын
Helpful! Thank you!
@psmontte
@psmontte 9 ай бұрын
How do you validate data again in server function?
@GabrielMPereira
@GabrielMPereira Жыл бұрын
Great video! Thank you a lot
@ItsMeBenny
@ItsMeBenny 10 ай бұрын
Great video !
@ChamaraHarindra
@ChamaraHarindra 11 ай бұрын
Thnx for the lesson. Do you know how to make shadcn select to get focused on error? It happens correctly for input. But doesn't happen as expected in select and radio group.
@kiranravi-k9p
@kiranravi-k9p 2 ай бұрын
If the validation values come from an API .? At that time how can we write this Form Validation? At that time the client and server were confused and I can't do that... Give us a video for that one... I have to know
@WebDevEducation
@WebDevEducation 2 ай бұрын
In your response from API, likely within handleSubmit: form.setError("fieldNameHere", { message: "Message from api here", });
@mohdali-yq8gq
@mohdali-yq8gq Жыл бұрын
Great Explanation!! Sir please can you post a full stack video with an extensive use of shadcn and shadcn form and use the PostgreSQL as a backend with prisma.
@WebDevEducation
@WebDevEducation Жыл бұрын
I'd love to do that - do a massive build similar to how sonny sangha does his videos / builds. Hopefully if I have more time in the future I can do more of those types of videos 🙏
@codeyalaya
@codeyalaya 10 ай бұрын
how to show #contact section of a long page, after submitting form using server actions with js disabled. #contact section is at last of the page.
@hollycow8171
@hollycow8171 9 ай бұрын
Can you do same without ShadeCDN. this is so cool
@mezza3890
@mezza3890 11 ай бұрын
Does anyone know why I get a hydration error whenever I use more than a single FormField within the form?
@captsha
@captsha Жыл бұрын
hey how would you do the same for files im trying to do it but facing some difficulties itll be helpful if could give a sample. Thank you
@niklausmikaelson7332
@niklausmikaelson7332 5 ай бұрын
If you tyoe in the input check in console it will give error that uncontrolled change to control
@WebDevEducation
@WebDevEducation 5 ай бұрын
If you add defaultValues to empty string in the react hook form instance it will clear this error 🙏
@techiesakar
@techiesakar Жыл бұрын
Triggering Select Button hides the Scrollbar. How to avoid this behaviour ?
@benjamincarriou8497
@benjamincarriou8497 11 ай бұрын
Hi and thx How to reset the form after submission ?
@ruanxun9454
@ruanxun9454 10 ай бұрын
in the function handleSubmit, I write form.reset() to clear all the inputs, but I am still a newbie, it may not be the best way.
@AlexTLOU
@AlexTLOU 10 ай бұрын
why is a simple form so complex 😢😢
@WebDevEducation
@WebDevEducation 10 ай бұрын
welcome to React 😂
@AlexTLOU
@AlexTLOU 10 ай бұрын
lmao, thanks for the video btw@@WebDevEducation
@TANJAVEN
@TANJAVEN 3 ай бұрын
excellent video
@quokka8687
@quokka8687 8 ай бұрын
Very helpfull!
@Topsquadjapan
@Topsquadjapan 2 ай бұрын
Typescript just gets in the way
@d4rzk252
@d4rzk252 10 ай бұрын
Great video just want to ask when the user takes the steps: 1. He clicks on the company 2. Fills in the input 3. Switches back to personal 4. Sends So accoutType - personal is set, but companyName is also set... It also sends comapanyName... Is there any way to prevent this? I don't think this should be happening
@d4rzk252
@d4rzk252 10 ай бұрын
I just did this: .refine( (data) => { if (data.accountType === 'company') { return !!data.companyName } data.companyName = ''"
@WebDevEducation
@WebDevEducation 10 ай бұрын
I would prefer to take the approach of on submit, just not sending the company name data etc to the server.
@d4rzk252
@d4rzk252 10 ай бұрын
@@WebDevEducation So I have to do this logic in the function and then submit it? Isn't there a way to do it through the zod that when this is active, this get deleted? Or just like this: if (values.accountType === 'personal') delete values.companyName console.log({ ...values }) ?
@OmarAfet
@OmarAfet Жыл бұрын
That was great! but how can I do a server action?
@WebDevEducation
@WebDevEducation Жыл бұрын
As far as I'm aware this method will only work by calling the server action from the submit handler, rather than as the form action.
@Nickforu
@Nickforu Жыл бұрын
Thank You😊
@Videoguy789
@Videoguy789 Жыл бұрын
Huh so I am still pretty new to web development and I realized that I don't really have much experience building forms. But this form management with ShadCN looks unnecessarily complicated - is it even more complicated if you decide not to use ShadCN and would build it with just React?
@WebDevEducation
@WebDevEducation Жыл бұрын
I'd say it's easier not to use shadcn or react hook form, but then for bigger forms it's a lot easier for your forms to become complicated. Once I learned the "rules" for building forms with shadcn and react hook form, I've found it so much easier to build and maintain forms but that's just me. If you're new to web dev I'd recommend trying to build as much as you can from scratch yourself before working with third party libs.
@tomich20
@tomich20 Жыл бұрын
So much inecessary boiler plate. What about creating a MultiSelect dropdown? u r screwed. anywho... U can use shadCn, Zod, and shadCn inputs just by using the {...register("element")}, there you wont need any of the stuff imported from . Keep away from it, is evil.🤪🤪
@codyoakes
@codyoakes Жыл бұрын
What about with inputs other than string? numbers, dates, bigint? I'm a little confused what the best way to handle this is in the Shadcn ui, zod, react-hook-form space is...
@Isaac-d1m
@Isaac-d1m Жыл бұрын
Check over the zod documentation
@codyoakes
@codyoakes Жыл бұрын
@@Isaac-d1m I have been looking over the zod docs, but it seems like the shadcn components make everything strings on submit (seems like this is a RHF behavior?) so the values can't be validated as numbers or dates in zod...were you able to get this to work? Any chance you can share a codepen/github repo? I'd love to see how it's done. Thanks!
@juan7114
@juan7114 Жыл бұрын
​@@codyoakesYou need to set the onChange value, if you need a number instead of string, just set onChange = ({target}) => field.onChange(field.value = +target.value) "+" Operator is a shorthand for Number(), so you can also use Number() if you want. Remember, input value is always a string, convert it to a number and then assign it to the field value.
@gahaIor
@gahaIor Жыл бұрын
HelloHi, what would be your approach if you wanted the text field to be filled from a variable instead of typing it manually, I made some attempts and it shows it correctly in the front end ( value={var} ), but when I submit the form it tells me that it is empty.
@WebDevEducation
@WebDevEducation Жыл бұрын
It sounds like what you need is to set the fields default value.
@Badis-n2u
@Badis-n2u 11 ай бұрын
What about file input or rich text editor 🤔 How ?
@WebDevEducation
@WebDevEducation 11 ай бұрын
No different, same approach 🙏
@aqarcity
@aqarcity 11 ай бұрын
Thank you very much
@RR-MQLTP
@RR-MQLTP Жыл бұрын
Good job 👏
@slavenDj
@slavenDj Жыл бұрын
Is it possible to use shadcn for file input?
@WebDevEducation
@WebDevEducation Жыл бұрын
Yes should work :)
@wahidlahlou
@wahidlahlou 4 ай бұрын
Awesome!
@AzamShaikh-gs1kc
@AzamShaikh-gs1kc Жыл бұрын
Appreciate it Sir Thanks
@maykon-oliveira
@maykon-oliveira Жыл бұрын
Just add a input type date, and everything breaks 😅
@Isaac-d1m
@Isaac-d1m Жыл бұрын
I think that's a zod issue
@UtkarshWasHereBeforeYou
@UtkarshWasHereBeforeYou 10 ай бұрын
You're the best
@anhvuuc8693
@anhvuuc8693 Жыл бұрын
Build form is never easy, I think. This is just a simple form.
@WebDevEducation
@WebDevEducation Жыл бұрын
Using shadcn / zod / react-hook-form 100% makes it easier
React Hook Form - Complete Tutorial (with Zod)
28:22
Cosden Solutions
Рет қаралды 149 М.
Война Семей - ВСЕ СЕРИИ, 1 сезон (серии 1-20)
7:40:31
Семейные Сериалы
Рет қаралды 1,6 МЛН
Почему Катар богатый? #shorts
0:45
Послезавтра
Рет қаралды 2 МЛН
I Never Want To Create Forms Any Other Way
57:53
Elliott Chong
Рет қаралды 31 М.
Shadcn ui calendar is BROKEN.. let's fix it!
20:30
WebDevEducation
Рет қаралды 11 М.
React Hook Form (+ Zod) - Complete Tutorial
31:21
ByteGrad
Рет қаралды 111 М.
This Folder Structure Makes Me 100% More Productive
24:36
Web Dev Simplified
Рет қаралды 122 М.
React JS crash course 2024 for beginners
39:40
WebDevEducation
Рет қаралды 9 М.
Next.js 15 Breakdown (Everything You Need To Know)
18:10
Web Dev Simplified
Рет қаралды 94 М.
When to use server actions in Next JS 14
5:28
WebDevEducation
Рет қаралды 11 М.