vaadin / docs

Official documentation for Vaadin and Hilla.
https://vaadin.com/docs
Other
29 stars 194 forks source link

Add error messages to field constraint samples #3548

Closed rolfsmeds closed 3 weeks ago

rolfsmeds commented 3 months ago

Once the error message API has been merged, make sure that the samples with constraints for each field have appropriate error messages for each constraint:

Follow-up to https://github.com/vaadin/flow-components/issues/4618

Related AC: https://github.com/vaadin/platform/issues/6707

vursen commented 3 months ago

I have a proposal:

How about we add a "Constraints" section to the DatePicker and TimePicker articles, replacing their min/max examples, to align these articles with text fields? In this section, we would also include the required constraint, which is currently missing. Then, we could also add this section to other fields like Select, ComboBox, etc, as they also have one constraint: required.

I'm not sure if using i18n for error messages is necessary for single-constraint components. Maybe we could use setErrorMessage() in their examples, or we could still use i18n for consistency.

rolfsmeds commented 3 months ago

I suppose we could do something like that, but let's keep the Custom Validation sections separate like now. As for ComboBox, it already has a Constraints section. I think the fields that only have required are Select, Checkbox and RadioButtonGroup, but it feels a bit silly to add a Constraints section just for that. And since you can use setErrorMessage for that anyway, maybe it doesn't need to be explicitly documented?

vursen commented 2 months ago

Meeting notes from our internal session on August 26, 2024: