You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For integrating Element.validationMessage with Ember's autotracking system, the addon builds on the assumption that whenever validationMessage of an element changes, also the value property of FormElement changes:
// native validation state doesn't integrate with Ember's autotracking, so we need to invalidate our `errors` getter explicitly when
// `this.value` changes by consuming it here.
This assumption is not correct in some cases:
<input type="time"> might be partially filled. Browser set InputElement.validity.badInput to true and populate InputElement.validationMessage with an error message in that case. But they do not update the value of the InputElement as it must not be a bad input.
Consumers may set a custom validation message, which depends on the current locale. The current locale may change and therefore the validation message without the value being changed.
For the second case a consumer may fork this repository and consume current locale in addition to the value in errors getter. But I don't see a solution for the first case. As far as I know there isn't any event fired from the browser when an user partially fills the text input.
I run into this limitation when doing a PoC on migrating an use case from ember-cp-validations to native validations of the platform using this addon. My use case required both: showing validation errors when input is partially filled and updating validation errors when the locale changes. The PoC showing the two problems could be found here: https://github.com/jelhan/ember-bootstrap-constraint-validations-intl-support-poc
I also asked at StackOverflow about this limitation of constraint validation API and if there is a way around it.
The text was updated successfully, but these errors were encountered:
For integrating
Element.validationMessage
with Ember's autotracking system, the addon builds on the assumption that whenevervalidationMessage
of an element changes, also thevalue
property ofFormElement
changes:ember-bootstrap-constraint-validations/addon/components/bs-form/element.js
Lines 22 to 23 in 87068d2
This assumption is not correct in some cases:
<input type="time">
might be partially filled. Browser setInputElement.validity.badInput
totrue
and populateInputElement.validationMessage
with an error message in that case. But they do not update thevalue
of theInputElement
as it must not be a bad input.For the second case a consumer may fork this repository and consume current locale in addition to the value in
errors
getter. But I don't see a solution for the first case. As far as I know there isn't any event fired from the browser when an user partially fills the text input.I run into this limitation when doing a PoC on migrating an use case from ember-cp-validations to native validations of the platform using this addon. My use case required both: showing validation errors when input is partially filled and updating validation errors when the locale changes. The PoC showing the two problems could be found here: https://github.com/jelhan/ember-bootstrap-constraint-validations-intl-support-poc
I also asked at StackOverflow about this limitation of constraint validation API and if there is a way around it.
The text was updated successfully, but these errors were encountered: