-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation error not bound to textfield #20
Comments
Hi Marco,
export default {
data() {
return {
formData: {
user: '',
password: ''
}
}
},
computed: {
validations() {
return this.step === 1
? {
user: {
label: 'Username',
validator: 'required'
}
}
: {
password: {
label: 'Password',
validator: 'required'
}
};
}
},
methods: {
gotoPass() {
let result = this.$validate(this.formData);
// ...
}
}
};
export default {
validations: {
user: {
label: 'Username',
validator: 'required'
},
password: {
label: 'Password',
validator: 'required'
}
},
data() {
return {
formData: {
user: '',
password: ''
}
}
},
methods: {
gotoPass() {
let customFieldset = this.step === 1 ? ['user'] : ['password'];
let result = this.$validate(this.formData, customFieldset);
// ...
}
}
}
export default {
data() {
return {
formData: {
user: '',
password: ''
}
}
},
methods: {
gotoPass() {
this.$resetValidations();
let customValidations =
this.step === 1
? {
user: {
label: 'Username',
validator: 'required'
}
}
: {
password: {
label: 'Password',
validator: 'required'
}
};
this.$setValidations(customValidations);
let result = this.$validate(this.formData);
// ...
}
}; I will update the relevant documents as soon as possible. |
Hi Elf-mouse, Thank you for the elaborate explanation. The problem i'm experiencing isn't with the actual validation though (this works), but the invalid style isn't bound the the textfield (mdc-text-field--invalid). This is what I see when i click on the button: The formdata is not valid, as is expected, but there is no styling. regards, Marco |
Because there is no specific usage of I have updated new demos to the document, and the current invalid message is displayed through If you have any better ideas, please let me know, thanks :) |
Hi Elf-mouse, Thank you for your help. The validator now works as a charm! I can follow your logic not to add an invalid prop to Perhaps you could add to the documentation that either kind regards, Marco |
@MarcoTroost , Thank you for your valuable suggestions! I will improve related documents in the next update. |
Hi,
First of all, thank you for the great work on BalmUI!
Love the fact that it follows MDC very closely.
I'm experiencing an issue with the validator though.
The form does validate (response is not valid when printed to the console), but the invalid class isn't bound to the faulty element, nor does it update the validation message.
Can you see what is the matter?
`
Kind regards,
Marco
The text was updated successfully, but these errors were encountered: