Skip to content

Commit

Permalink
IBX-5197: [Change password] Error messages stack on submit (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabowskiM committed Mar 7, 2023
1 parent 9e5dbe2 commit 3395546
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
const toggleError = (isError, message, target) => {
const methodName = isError ? 'add' : 'remove';
const field = target.closest(SELECTOR_FIELD);
const labelWrapper = field.querySelector('.ibexa-form-error');
const errorNodes = labelWrapper.querySelectorAll('.ibexa-field__error');
const errorsWrapper = field.querySelector('.ibexa-form-error');
const errorNodes = errorsWrapper.querySelectorAll('.ibexa-form-error__row');

field.classList[methodName](CLASS_INVALID);
target.classList[methodName](CLASS_INVALID);

errorNodes.forEach((el) => el.remove());

if (isError) {
labelWrapper.append(createErrorNode(message));
errorsWrapper.append(createErrorNode(message));
}
};

Expand Down

0 comments on commit 3395546

Please sign in to comment.