Skip to content
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

Implement HasValidation in CheckBox #188

Closed
zanonmark opened this issue Jun 17, 2019 · 3 comments
Closed

Implement HasValidation in CheckBox #188

zanonmark opened this issue Jun 17, 2019 · 3 comments
Labels
awaits another ticket Blocked by other issue flow

Comments

@zanonmark
Copy link

Vaadin 14.0.0.beta3.

Is it possible to have CheckBox implement the HasValidation interface?

The reason is that all of the major fields (TextField, ComboBox, NumberField, DateField, etc.) implement it, so one can execute .setErrorMessage() on those fields if necessary, which you can't do on CheckBox (only on CheckBoxGroup?!).

Thanks,
MZ

@ZheSun88 ZheSun88 transferred this issue from vaadin/framework Jun 18, 2019
@web-padawan
Copy link
Member

Thanks for the issue. This depends on web component issue: vaadin/vaadin-checkbox#84

There is a pending PR for it (and it has been there for a very long time).

One of the reasons we didn't merge it yet is that we don't have any idea on how the required indicator should look like for a single checkbox: #85 (comment)

@jouni
Copy link
Member

jouni commented Sep 30, 2020

So, the HasValidation interface bring in the setErrorMessage() method? That sounds a bit problematic, as that would imply that Check Box should be able to show that message somewhere. But the Check Box web component not a similar field by itself as the others, as it doesn’t have a similar kind of field label or error message.

I’m not sure if we should “promote” Check Box and Radio Button web components to similar fields as Text Field etc, so that they would have the label, error-message, and helper-text properties, and the helper slot as well. That would basically cater to this use case here as well.

But to me, the so-called “correct” solution is abstracting the “field behaviors” (label, required indicator, helper and error messages) out of the existing field components, and allowing any “input components” to be used together with that. Like what we’ve discussed on many occasions before (https://github.com/vaadin/vaadin-core/issues/238).

After that, the CheckBox Java component could be a field, and the CheckboxGroup Java component could perhaps use the lower level CheckBoxInput Java component internally, which does not have error messages or helper texts.

@vaadin-bot vaadin-bot transferred this issue from vaadin/vaadin-checkbox-flow Oct 6, 2020
@vaadin-bot vaadin-bot added awaits another ticket Blocked by other issue flow labels Oct 6, 2020
@web-padawan
Copy link
Member

Now when the issues for Flow components are moved to the web component repos, I'm closing this in favor of #84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaits another ticket Blocked by other issue flow
Projects
None yet
Development

No branches or pull requests

4 participants