-
Notifications
You must be signed in to change notification settings - Fork 14.6k
FormItem: Form item emits array of errors when an error occurs #12733
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
Conversation
|
Deploy preview for element ready! Built with commit 77563d4 |
|
@ziyoung This is the payload emitted by the Form component at the moment. It does not emit the current error message. Personally, I think both Form and FormItem should emit that error message to enable developers to wrap these components in any way they want. I disagree with how the payload is being evaluated right now on the Form (as an array). An object of declared keys would be the way to go usually, but for the sake of backwards compatibility, I think It should be added as the third entry in that array anyway. |
|
@ziyoung I agree with @YamenSharaf that we need more flexibility with the error messages to give the developers more power to control how they show the errors |
|
@YamenSharaf Is it better to put the error message in the validate event of form? |
|
If validate event emits error message, is it necessary to add error event? |
|
@ibufu @ziyoung Personally I think we should have both, because:
|
|
What would you plan to do with these strings? For example? String comparison (on error message) does not make sense to me. |
|
@wacky6 String comparison is icky, but sometimes you wanna respond to a certain error in a certain way, let that be dimming a button or popping an alert. It could be that I want errors to appear on the side of the form as opposed underneath inputs. The way things are set up now there's no way to access these errors for any reason which I don't think is very flexible. |
|
In that case, I would append additional codes after calling validate(), and check the v-model / form's value directly. Validators are supposed to show a message, but nothing more. |

Please make sure these boxes are checked before submitting your PR, thank you!
devbranch.