[Feature request] dispatch event when error state changes #1222
thatdudemanguy
started this conversation in
Open for contributions
Replies: 2 comments 2 replies
-
Makes sense. We used to have this in the previous version of ValidateMixin. All needed info can be found in updated(changedProps) {
super.updated(changedProps);
if (changedProps.has('validationStates')) {
const prevStates = changedProps.get('validationStates');
Object.entries(this.validationStates).forEach(([type, feedbackObj]) => {
if (!deepEqual(feedbackObj, prevStates[type])) {
this.dispatchEvent(new Event(`${type}StateChanged`, { detail: feedbackObj }));
}
});
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
-
Since error is 'more important' than other feedback types, we could consider an <lion-form @invalid-changed="${({currentTarget}) => {
this._btnDisabled = currentTarget.invalid;
}}">
<form>
<lion-input .validators="${[new Required()]}"></lion-input>
<lion-button type="submit" .disabled="${this._btnDisabled}">Submit</lion-button>
</form>
</lion-form> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello
As an addition to
showsFeedbackForChanged
andshowsFeedbackForErrorChanged
as found in the validateMixin, it would be nice to include an event that dispatches whenever the error state itself changes, and have it include all active errors.e.g.:
Beta Was this translation helpful? Give feedback.
All reactions