Topic: Validation of mdb-select
eladhr83 free asked 4 years ago
Hello I am using the veevalidate mechanism of Vue. It works great on regular Inputs, but I do not know how to validate if an option has been selected or not. I have searched the support forum and found no solution for this, either no mention for it in the documentation section.
Mikołaj Smoleński staff answered 4 years ago
Hi there,
VeeValidate is not working with select component as follows from my research. Here are some examples of forms validation in demo application including MDB Select component: https://vue.mdbootstrap.com/#/forms/pro/validation
Also, I made an example of VeeValidation of MDB Input. Here's the code:
<validation-provider rules="required" v-slot="{ valid, invalid, validated, errors }">
<mdb-input v-model="value" name="myinput" label="Required rule validation" :validation="validated" :isValid="valid" :invalidFeedback="errors[0]" required />
</validation-provider>
import { ValidationProvider, extend } from 'vee-validate';
import { required } from 'vee-validate/dist/rules';
extend('required', {
...required,
message: 'This field is required'
});
Best regards
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Vue
- MDB Version: 6.1.1
- Device: PC
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: No