Тёмный

Next JS forms with Shadcn UI (the EASY way) 

WebDevEducation
Подписаться 6 тыс.
Просмотров 33 тыс.
50% 1

⭐️ webdeveducation.com
Next JS 14 how to validate forms with shadcn ui and build beautiful forms with shadcn ui, next js form validation, next js zod, next js react-hook-form
THE SHADCN UI COURSE IS NOW AVAILABLE - GET IT FOR JUST $12.99 BELOW!
www.udemy.com/course/shadcn-u...
Github repo:
github.com/tomphill/shadcn-fo...
🔔 Subscribe if you want more free tutorials like this one! ru-vid.com...
#nextjs14 #zod #reactjs #shadcn #reacthookform

Опубликовано:

 

23 ноя 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 77   
@WebDevEducation
@WebDevEducation 6 месяцев назад
I was sick when recording this so do me a favour and give the video a thumbs up 👍😂
@ismaeltinta6118
@ismaeltinta6118 6 месяцев назад
haha, I gave it a thumps up
@WebDevEducation
@WebDevEducation 6 месяцев назад
@@ismaeltinta6118 thank you sir! 😊
@molomekeys3938
@molomekeys3938 4 месяца назад
nevermind it's a wonderful vidoe thank you sir
@bhavyakothari635
@bhavyakothari635 4 месяца назад
Definitely mate. What a great video and the way you quickly explained it. No BS just pinpointed. Great video man. +Subscribed.
@rikisyahputra3805
@rikisyahputra3805 Месяц назад
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.
@eric_so_good
@eric_so_good 5 месяцев назад
hey man i just went back after realized I haven't thank you about how straight forward this was! Thank you.
@mohdali-yq8gq
@mohdali-yq8gq 6 месяцев назад
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 2 дня назад
Brilliant tutorial, explained really well - thanks a lot! Hands down the top guide for shadcn and forms out there!
@nonada2251
@nonada2251 6 месяцев назад
Thank you very much, I finally managed to understand how to use these tools :)
@oussamazerroug8171
@oussamazerroug8171 3 месяца назад
Amazing it's exactly what I was looking for ❤
@naylord5
@naylord5 6 месяцев назад
Thank you so much for sharing mate! I hope you get well very soon 🙌🙌
@WebDevEducation
@WebDevEducation 6 месяцев назад
You're welcome man and thank you 😊🙏
@tsykin
@tsykin 3 дня назад
Thank you so much for suc a clear explanation!
@ibrahimcious
@ibrahimcious 5 месяцев назад
What a great explanation! Subscribed!
@WebDevEducation
@WebDevEducation 5 месяцев назад
Thank you 😊 🙏
@bobbyboxer2664
@bobbyboxer2664 22 дня назад
Amazing video! Thank you so much 🙏🏼
@prapathsuayroop2341
@prapathsuayroop2341 3 месяца назад
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 3 месяца назад
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 🙏
@froggysan5203
@froggysan5203 4 месяца назад
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
@ervczek
@ervczek Месяц назад
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?
@Adrian_Galilea
@Adrian_Galilea 4 месяца назад
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.
@ONEOTPOfficial
@ONEOTPOfficial 2 месяца назад
it was really very helpfull man
@coolcubestudio
@coolcubestudio 5 месяцев назад
Helpful! Thank you!
@GabrielMPereira
@GabrielMPereira 4 месяца назад
Great video! Thank you a lot
@AddictedGamerr
@AddictedGamerr Месяц назад
Love it straight to point but i make a vidoe with phn field with all the country code and validation
@cesarquispe2413
@cesarquispe2413 22 дня назад
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.
@mohdali-yq8gq
@mohdali-yq8gq 6 месяцев назад
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 6 месяцев назад
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 🙏
@buraxta_
@buraxta_ 5 месяцев назад
it's so clear and useful. thank you
@ItsMeBenny
@ItsMeBenny 2 месяца назад
Great video !
@AzamShaikh-gs1kc
@AzamShaikh-gs1kc 6 месяцев назад
Appreciate it Sir Thanks
@debarshidas8678
@debarshidas8678 Месяц назад
Thanks man! ♥
@quokka8687
@quokka8687 8 дней назад
Very helpfull!
@chinmayghule8272
@chinmayghule8272 3 месяца назад
There are quite a few videos on shadcn on RU-vid 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 3 месяца назад
Already covered that in my shadcn ui calendar video 😊🙏
@aqarcity
@aqarcity 3 месяца назад
Thank you very much
@WebDevFreelancer4
@WebDevFreelancer4 6 месяцев назад
Thank You😊
@ChamaraHarindra
@ChamaraHarindra 4 месяца назад
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.
@RR-rw5bc
@RR-rw5bc 6 месяцев назад
Good job 👏
@user-lv3cj7ky1x
@user-lv3cj7ky1x Месяц назад
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?
@shajiths7727
@shajiths7727 4 месяца назад
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
@psmontte
@psmontte Месяц назад
How do you validate data again in server function?
@hollycow8171
@hollycow8171 Месяц назад
Can you do same without ShadeCDN. this is so cool
@codeyalaya
@codeyalaya 2 месяца назад
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.
@UtkarshWasHereBeforeYou
@UtkarshWasHereBeforeYou 2 месяца назад
You're the best
@mezza3890
@mezza3890 3 месяца назад
Does anyone know why I get a hydration error whenever I use more than a single FormField within the form?
@benjamincarriou8497
@benjamincarriou8497 3 месяца назад
Hi and thx How to reset the form after submission ?
@ruanxun9454
@ruanxun9454 2 месяца назад
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.
@gahaIor
@gahaIor 5 месяцев назад
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 5 месяцев назад
It sounds like what you need is to set the fields default value.
@OmarAfet
@OmarAfet 4 месяца назад
That was great! but how can I do a server action?
@WebDevEducation
@WebDevEducation 4 месяца назад
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.
@techiesakar
@techiesakar 6 месяцев назад
Triggering Select Button hides the Scrollbar. How to avoid this behaviour ?
@codyoakes
@codyoakes 6 месяцев назад
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...
@user-cz9hx3ox1u
@user-cz9hx3ox1u 5 месяцев назад
Check over the zod documentation
@codyoakes
@codyoakes 5 месяцев назад
@@user-cz9hx3ox1u 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 4 месяца назад
​@@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.
@Videoguy789
@Videoguy789 5 месяцев назад
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 5 месяцев назад
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 4 месяца назад
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.🤪🤪
@user-wr7ou8ih5s
@user-wr7ou8ih5s 3 месяца назад
What about file input or rich text editor 🤔 How ?
@WebDevEducation
@WebDevEducation 3 месяца назад
No different, same approach 🙏
@avrakadavra1552
@avrakadavra1552 3 месяца назад
8:49 intellisense is not working, Any solution?
@d4rzk252
@d4rzk252 3 месяца назад
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 3 месяца назад
I just did this: .refine( (data) => { if (data.accountType === 'company') { return !!data.companyName } data.companyName = ''"
@WebDevEducation
@WebDevEducation 3 месяца назад
I would prefer to take the approach of on submit, just not sending the company name data etc to the server.
@d4rzk252
@d4rzk252 3 месяца назад
@@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 }) ?
@slavenDj
@slavenDj 5 месяцев назад
Is it possible to use shadcn for file input?
@WebDevEducation
@WebDevEducation 5 месяцев назад
Yes should work :)
@maykon-oliveira
@maykon-oliveira 6 месяцев назад
Just add a input type date, and everything breaks 😅
@user-cz9hx3ox1u
@user-cz9hx3ox1u 5 месяцев назад
I think that's a zod issue
@programwithalex
@programwithalex 2 месяца назад
why is a simple form so complex 😢😢
@WebDevEducation
@WebDevEducation 2 месяца назад
welcome to React 😂
@programwithalex
@programwithalex 2 месяца назад
lmao, thanks for the video btw@@WebDevEducation
@anhvuuc8693
@anhvuuc8693 6 месяцев назад
Build form is never easy, I think. This is just a simple form.
@WebDevEducation
@WebDevEducation 6 месяцев назад
Using shadcn / zod / react-hook-form 100% makes it easier
Далее
10 common mistakes with the Next.js App Router
20:37
Просмотров 178 тыс.
React Hook Form - Complete Tutorial (with Zod)
28:22
Просмотров 78 тыс.
РЖАВАЯ МОЛОДОСТЬ. ДЕВЯТКА
33:56
Просмотров 381 тыс.
When to use server actions in Next JS 14
5:28
Просмотров 7 тыс.
Why I Pick ShadCN and Tailwind for all my projects
18:53
All 29 Next.js Mistakes Beginners Make
1:45:10
Просмотров 55 тыс.
How Shadcn/ui ACTUALLY Works
32:38
Просмотров 83 тыс.
Fetching Data Doesn't Get Better Than This
6:58
Просмотров 63 тыс.
React Hook Form & React 19 Form Actions, The Right Way
16:08
These 2 UI Libraries Are The Perfect Combo
5:03
Просмотров 118 тыс.
The Origins of Hacker Culture
11:16
Просмотров 3,8 тыс.
РЖАВАЯ МОЛОДОСТЬ. ДЕВЯТКА
33:56
Просмотров 381 тыс.