Easy Form Validation with Vuelidate | Vue 3 Tutorial

  Рет қаралды 58,104

LearnVue

LearnVue

Күн бұрын

Пікірлер: 80
@pagevpetty
@pagevpetty 3 жыл бұрын
0:30 Add dependencies, 2:38 Options API Validation, 5:49 Composition API Validation, 7:29 Better Validations, 8:43 Display Error Messages 9:35 Custom Validation
@lunarcdr3083
@lunarcdr3083 3 жыл бұрын
Thanks!
@QueeeeenZ
@QueeeeenZ 2 жыл бұрын
One suggestion for the composition API would be to use for shorter and cleaner syntax
@crazy_coder
@crazy_coder 2 жыл бұрын
Can you please give me an example of same
@_timestamp
@_timestamp 2 жыл бұрын
@@crazy_coder // ----------- replace this ----------- export default { setup(){ // code here return {} } } // ----------- with this ----------- // code here
@fiendsgaming7589
@fiendsgaming7589 Жыл бұрын
@@crazy_coder read the official Vue3 Docs
@fiendsgaming7589
@fiendsgaming7589 Жыл бұрын
@@crazy_coder import { ref } from 'vue' const count = ref(0) function increment() { count.value++ } {{ count }}
@dethcx22
@dethcx22 3 жыл бұрын
This isn't actually using the Composition API as you're still mixing in the Options API with the methods object and referencing 'this', at best this is a mix of both APIs. For reference, anyone using the Composition API. Create either a normal constant or a computed property with the object you want for your validation (see example below). Then you can use the touch() method to run the validator, or run the validate method: const rules = { credentials: { username: { required }, email: { required, email }, password: { required }, }, } const v$ = useVuelidate(rules, store) // Here I'm just referencing my Pinia store which is using reactive objects. Inside my function I run: const isFormCorrect = await v$.value.$validate() and then check for errors: if (!isFormCorrect) return Do you checking here, else run function.
@raydenchan
@raydenchan 2 жыл бұрын
Thanks a lot @noxi
@crazy_coder
@crazy_coder 2 жыл бұрын
Can you please provide an example of s
@francoislacock
@francoislacock 2 жыл бұрын
Very useful video and tutorial. Thank you! I just coded it with the Vue 3 script setup tag from the start and was easy to still get it right.
@thulas-mkhwanazi
@thulas-mkhwanazi 3 жыл бұрын
Great tutorial. This helped me a lot with Vue 3 Typescript project
@LearnVue
@LearnVue 3 жыл бұрын
Glad it helped!
@cutipets8706
@cutipets8706 3 жыл бұрын
console.log(this.v$.email.$errors); when i try to display the list of errors to the console it gives me an empty array, I dont know why?
@davidadu-tenkorang3186
@davidadu-tenkorang3186 3 жыл бұрын
You saved me big time.
@LearnVue
@LearnVue 3 жыл бұрын
I'm beyond glad that I could help 😇
@annizma6873
@annizma6873 3 жыл бұрын
@@LearnVue You saved me too Т.Т
@artemkomarov9902
@artemkomarov9902 2 жыл бұрын
Hello, needs upadates) if we use script setup and submit form we need use async await to validate...
@weristsam
@weristsam 3 жыл бұрын
Great tutorial! but i cannot access v$.. when i print {{ v$ }} i got the following array of data => { "$dirty": false, "$path": "__root", "$model": null, "$error": false, "$errors": [], "$invalid": false, "$anyDirty": false, "$pending": false, "$silentErrors": [] }.. their is no v$.email or something else.. i checked the code several times.. i have exakt the same code Edit: in my case it only work with "this.v$.email.$error" and "this.v$.email.email.$message".. i'm wondering, because i return v$: useValidate() in ma data function.
@mangouni
@mangouni 3 жыл бұрын
Vuelidate documentation is difficult to understand, so.. can i still get and show error messages with VUE 3 without using the Composition API shown in the video? Also, How to create custom regex validator and use it? It is confusing.. I tried.. still trying.
@LearnVue
@LearnVue 3 жыл бұрын
try the helpers.regex method (vuelidate-next.netlify.app/custom_validators.html#regex-based-validator) and to make sure your regular expression is doing what i want, i use this tool a ton! regexr.com/
@mangouni
@mangouni 3 жыл бұрын
@@LearnVue thank you for the useful links! Since I need to get things done I chose to do the validation without Vuelidate. Maybe I will come back to the documentation in the near future :)
@abubakirmahkamov
@abubakirmahkamov 2 жыл бұрын
Thank you for this lesson .This video is very useful for me.
@hadeelkamalgobbar4694
@hadeelkamalgobbar4694 Жыл бұрын
when i added tihs statement => this.v$.$validate() , this error apeared => this.v$.validate is not a function, i don't know what's the reason!!!!! :(
@kennyendowed9814
@kennyendowed9814 3 жыл бұрын
nice one but can i see how to handle Strong passwords need to have a letter, a number, a special character, and be more than 8 characters long. for password validation
@LearnVue
@LearnVue 3 жыл бұрын
for that, you can use Vuelidate's minLength to make sure it's longer than 8 characters. And then use a custom validator to check for a letter, number, and special character. You can use a regular expression and this is the documentation for the custom validations: vuelidate.js.org/#sub-simplest-example
@josepacheco1063
@josepacheco1063 3 жыл бұрын
awesome! keep making this kind of video. specially for vue + laravel! thanks
@LearnVue
@LearnVue 3 жыл бұрын
Glad you liked it!
@TheMalni
@TheMalni 2 жыл бұрын
Thanks a lot, it was very useful tutorial! 🔥
@Troy-ol5fk
@Troy-ol5fk 3 жыл бұрын
how to validate checkboxs? for example, I want to make sure at least 3 out of 10 check boxes are checked
@ddung203
@ddung203 2 жыл бұрын
I can't hear English, the video has no subtitles?
@Useroelas97
@Useroelas97 3 жыл бұрын
thank you so much :) . please how can we reset form ( errors ) with composition api ?. Thank you
@usertester8982
@usertester8982 3 жыл бұрын
Hey I try to run same validation method but I am getting error in console Uncaught TypeError: this.v$.validate is not a function Can you please help me?
@siddeshbarhate7516
@siddeshbarhate7516 3 жыл бұрын
same error please help
@abhinavsharma5526
@abhinavsharma5526 3 жыл бұрын
use $validate instead of validate
@happychristian1389
@happychristian1389 3 жыл бұрын
is this one better or VeeValidate?
@jessicaryan9820
@jessicaryan9820 2 жыл бұрын
So much nicer than vee-lidate and yup. Thank you!!
@martinszeltins2045
@martinszeltins2045 13 күн бұрын
Regle is the successor of Vuelidate since Vuelidate was discontinued.
@faredshadman
@faredshadman 2 жыл бұрын
Hi, after submit completed it shows required errors again , how can i fix it? It is because I change input fields values to empty string, any way to handle it ?
@faredshadman
@faredshadman 2 жыл бұрын
const v$ = useValidate(rules, state, { $rewardEarly: true });
@RicardoGarcia-wk8ds
@RicardoGarcia-wk8ds 2 жыл бұрын
Very, Very useful! Thank you Learn Vue
@priya6491
@priya6491 2 жыл бұрын
Please post a video about Vuelidate to show errors instead of using composition api>
@KhanhLe-vi6gr
@KhanhLe-vi6gr 3 жыл бұрын
Awesome video. Thank you
@disa1710
@disa1710 3 жыл бұрын
Great video! Vuelidate docs don't use a computed property for the rules object when using composition API. Is that optional? Or are the docs wrong?
@LearnVue
@LearnVue 3 жыл бұрын
Great question! Computed is only needed if your rules are accessing a reactive value, like in the example from the video. This is the part of the docs that use that reactive and computed: vuelidate-next.netlify.app/advanced_usage.html#using-reactive-state.
@rosia1948
@rosia1948 3 жыл бұрын
Awesome man👍
@pagevpetty
@pagevpetty 3 жыл бұрын
I tried to get the cheat sheet, but after I put in my email nothing happened 😢 .
@msdnsditlabs5328
@msdnsditlabs5328 3 жыл бұрын
Awesome! Thank you so much buddy
@LearnVue
@LearnVue 3 жыл бұрын
any time - thanks! 😇
@brunoberrehuel4833
@brunoberrehuel4833 2 жыл бұрын
Amazing content, great video and awesome explanations !
@LearnVue
@LearnVue 2 жыл бұрын
glad it helps :)
@hackwithharsha5228
@hackwithharsha5228 3 жыл бұрын
Thank You, Please help me with following question if you have any idea..( Note: not related to this video.. ) In my current project, the bundle has becoming bigger and bigger which will lead to more load time for user.. ( This will include some Ajax requests too once the bundle received by client.. Now, I have added pre-loader component in App.vue component which will slow loading screen or window until the document.ready is complete.. which will works good.. The problem with this solution, if a user has slow network as pre-loader component is in bundle which is big size user has to wait for loading screen until the bundle is fully loaded.. which is not great..) what I am expecting is some solution with 'index.html', having a loader in the inital index.html file which is small in size and disable it once the bundle and ajax requests are loaded... any idea how to achieve this in Vue ?
@madhz007
@madhz007 3 жыл бұрын
Amazing tutorial. How about server side validation such as checking if username is taken? How is that integrated with Vuelidate?
@jessicaryan9820
@jessicaryan9820 2 жыл бұрын
Axios
@eduardomavlyutov4710
@eduardomavlyutov4710 2 жыл бұрын
Thanks for your video!
@antoniogiroz
@antoniogiroz 3 жыл бұрын
Great video! Can you create a similar example for VeeValidate? Thanks!
@LearnVue
@LearnVue 3 жыл бұрын
definitely something ill look more into! thanks for the suggestion :)
@serdar_a
@serdar_a 2 жыл бұрын
I wrote into the useValidate function first state and then rules - that caused the problem "Maximum call stack size exceeded". Honestly i didn't expected that the order first rules then state is imported. Could you explain why the order matters? Short: const v$ = useValidate(rules, state) does work and const v$ = useValidate(state, rules) doesn't work!
@timzeynalov3537
@timzeynalov3537 3 жыл бұрын
v$ is undefined vetur problems how cai I fix that?
@LearnVue
@LearnVue 3 жыл бұрын
many of the new vue 3 ways of writing code are still being developed in Vetur, you could always hard ignore lines in Vetur, but typically I just ignore the issues.
@TechnoTrace
@TechnoTrace 3 жыл бұрын
Thanks for your awesome explanation, can you please tell me exactly how to implement vuelidate with vuex in a effective and scalable way with more maintainable code.
@paulojose7568
@paulojose7568 3 жыл бұрын
wait, isn't it $v????
@LearnVue
@LearnVue 3 жыл бұрын
That's what I thought at first too, because that's the normal Vue syntax. But Vuelidate actually recommends using v$ or just v for the Vuelidate instance: vuelidate-next.netlify.app/guide.html#checking-for-validation-state
@softwareEngineerKunwar
@softwareEngineerKunwar 3 жыл бұрын
thanks for video
@LearnVue
@LearnVue 3 жыл бұрын
you're welcome! thanks for watching
@zergzerg4844
@zergzerg4844 2 жыл бұрын
Thanks for video but you told very basic thing. It didn't help much. How about tell us how to use regex and validate alfabet fields or digit fields? How does it use?
@abimaeltavares1620
@abimaeltavares1620 3 жыл бұрын
Nice nice nice!!!!! Thx
@LearnVue
@LearnVue 3 жыл бұрын
Thank you for watching!
@justAblog
@justAblog 3 жыл бұрын
Thanks
@LearnVue
@LearnVue 3 жыл бұрын
No problem - thanks for watching! 😀
@Popc1007
@Popc1007 2 жыл бұрын
thanks
@motu0427
@motu0427 2 жыл бұрын
Lovee from Pakistan
@GigaHertZ28
@GigaHertZ28 3 жыл бұрын
this.v$.$validate() is not a function
@siddeshbarhate7516
@siddeshbarhate7516 3 жыл бұрын
same error please help
@213benimulia
@213benimulia 3 жыл бұрын
have u found the solution? i got same error
@thatsenam9183
@thatsenam9183 3 жыл бұрын
Great
@siddeshbarhate7516
@siddeshbarhate7516 3 жыл бұрын
"TypeError: _this.v$.validate is not a function" please reply for this error
@dan_vl1909
@dan_vl1909 3 жыл бұрын
Don't know if you already found it, but it is "$validate", not "validate".
@xxxx-xx4im
@xxxx-xx4im 2 жыл бұрын
What a great content,ty so much!!
Vue 3 + Firebase Authentication in 10 Minutes
9:06
LearnVue
Рет қаралды 64 М.
Easy Form Validation With Vuelidate | Vue 3
8:19
John Komarnicki
Рет қаралды 34 М.
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН
JISOO - ‘꽃(FLOWER)’ M/V
3:05
BLACKPINK
Рет қаралды 137 МЛН
Ful Video ☝🏻☝🏻☝🏻
1:01
Arkeolog
Рет қаралды 14 МЛН
Ozoda - Alamlar (Official Video 2023)
6:22
Ozoda Official
Рет қаралды 10 МЛН
Learn Pinia Setup Stores in 30 MINUTES! (Vue JS 3)
33:41
Make Apps with Danny
Рет қаралды 7 М.
You don't need a frontend framework
15:45
Andrew Schmelyun
Рет қаралды 139 М.
Two Vue Directives that Boost App Performance
3:28
LearnVue
Рет қаралды 29 М.
Conquering Forms in Vue - VueConf US 2023
33:32
Vue Mastery
Рет қаралды 5 М.
Vuetify Tutorial #26 - Simple Form Validation
6:07
Net Ninja
Рет қаралды 61 М.
The Ultimate Vue 3 Tutorial (100% Composition API)
6:12:34
Laith Academy
Рет қаралды 272 М.
Why I Don't Use v-model In Forms in Vue.js | Form Tips
12:11
Program With Erik
Рет қаралды 43 М.
What's New In Vue 3.5?
2:55
LearnVue
Рет қаралды 21 М.
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН