Skip to content

Commit 3f41c04

Browse files
committed
NGSTACK-794 add check if tags field is actually required before validating
1 parent d69d8f6 commit 3f41c04

File tree

1 file changed

+5
-3
lines changed
  • bundle/Resources/public/admin/js/fieldType

1 file changed

+5
-3
lines changed

bundle/Resources/public/admin/js/fieldType/eztags.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
(function (global, doc, ibexa) {
2-
const SELECTOR_FIELD = '.ibexa-field-edit--eztags.ibexa-field-edit--required';
2+
const SELECTOR_FIELD = '.ibexa-field-edit--eztags';
33

44
class TagsValidator extends ibexa.BaseFieldValidator {
5-
validateTags(event) {
5+
validateTags(event) {
6+
const fieldContainer = event.currentTarget.closest(SELECTOR_FIELD);
7+
const isRequired = fieldContainer && fieldContainer.classList.contains('ibexa-field-edit--required');
68
const isEmpty = !event.target.value;
7-
const isError = isEmpty;
9+
const isError = isRequired && isEmpty;
810
const label = event.target.closest(SELECTOR_FIELD).querySelector('.ibexa-field-edit__label').innerHTML;
911
const result = {isError};
1012
if (isEmpty) {

0 commit comments

Comments
 (0)