Тёмный

Forms with validation (Next.js + Zod + react-hook-form) 

Diego Ramos
Подписаться 46
Просмотров 10 тыс.
50% 1

In this video you'll learn to create a form with validation using react-hook-form, and zod.

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

 

3 фев 2023

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 8   
@gadmugambi
@gadmugambi 2 месяца назад
Thanks a lot man. God bless you
@nsd861
@nsd861 9 месяцев назад
i have two date values From and To, i want to validate those dates, such the To date value is not earlier than the From date, how to do so??
@MrPukamir
@MrPukamir Год назад
what if your select options would come from db, how your code would change?
@ramozdev
@ramozdev Год назад
This only affects the zod schema. You can treat the select the same as the name in this example. Define the zod schema validation for the select to expect a non-empty string. By doing this you are accepting any string value from the select, expect for empty strings.
@techs7296
@techs7296 Год назад
Why form has weight as string defined, makes it difficult to post the data into the database.
@ramozdev
@ramozdev Год назад
I do this because there is no way to return a JavaScript number from an input element. Please note, on 2:12 I explained that all inputs return a string in HTML, even the number input. You can verify this by checking the type of `event.target.value` when trying to read a value from an input.
@techs7296
@techs7296 Год назад
@@ramozdev I asked because I really want a proper solution. For now working by Using Number() .Open to any solution .
@filipfedorisin3457
@filipfedorisin3457 Год назад
@@techs7296 you can link everything to state object with onchange sync and then on submit verify the data, then you can get anything and bypass the string parsing... optimally regex, then you can completely remove zod and react hook form
Далее
Why I use Zod with Server Actions
15:21
Просмотров 12 тыс.
2DROTS vs WYLSACOM! КУБОК ФИФЕРОВ 1 ТУР
07:25
Телеграмм-Колян Карелия #юмор
00:10
Next JS Form Validation Using Server Actions
19:41
Просмотров 1,8 тыс.
Create Form and Validation With Shadcn UI | NextJs 13
43:53
Next.js 14: JSON API Validation with ZOD
12:32
Next js vs React - (2024) Difference Explained
10:16
Просмотров 56 тыс.
React Hook Form - Complete Tutorial (with Zod)
28:22
Просмотров 94 тыс.