Replies: 2 comments 1 reply
-
Thanks for the kind words, I'm not entirely sure what you want to do here but will try to answer to the best of my understanding. There are a few issues in your example: You are calling Another aspect of validation is you can either go field-level validation or form-level validation but you cannot mix them. Personally, when I design fields like pickers I do this:
To me, date pickers help the user enter the date correctly so there is no point in validating the format, maybe you can design the picker component in such a way that the user can either have a correct date or not at all which makes it much easier to reason with. If you are trying to communicate the field errors to parent components that do not have a |
Beta Was this translation helpful? Give feedback.
-
Thank you for clarifying and sharing your opinion 🙏 I didn't want to use the datepicker in the example for simplicity sake, so i used The use case here is a datepicker component that can produce I think you're right, validating the date format is not the best approach to provide some feedback to the user, it's more like a workaround. Perhaps a better approach would be using input masks or maybe change the validator logic |
Beta Was this translation helpful? Give feedback.
-
The application that i'm working on has a lot of forms. The forms have datepickers. The datepicker field must be a date in dd.mm.yyyy format. It seems like a good idea to add validation rule into datepicker component and not bother with validating it on the form level (so that we don't have to stick the date validator into every form) But then on the form level we might have server validation, and ideally the frontend and backend validation errors should be merged into an array of strings.
I've been trying to get the child errors (input field) to show up in the parent component (form) with vee-validate but had no success. Is there a way to do that?
Here is the code example: https://codesandbox.io/s/veevalidate-custom-input-child-errors-in-parent-9d4gn?file=/src/components/AppPage.vue
If it's not intended to work like that what would be the best approach in this situation in your opinion?
ps VeeValidate is awesome ⭐ 👍
Beta Was this translation helpful? Give feedback.
All reactions