Skip to content

Commit

Permalink
NGSTACK-794 add check if tags field is actually required before valid…
Browse files Browse the repository at this point in the history
…ating
  • Loading branch information
RobertK0 committed Feb 14, 2025
1 parent d69d8f6 commit 3f41c04
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bundle/Resources/public/admin/js/fieldType/eztags.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
(function (global, doc, ibexa) {
const SELECTOR_FIELD = '.ibexa-field-edit--eztags.ibexa-field-edit--required';
const SELECTOR_FIELD = '.ibexa-field-edit--eztags';

class TagsValidator extends ibexa.BaseFieldValidator {
validateTags(event) {
validateTags(event) {
const fieldContainer = event.currentTarget.closest(SELECTOR_FIELD);
const isRequired = fieldContainer && fieldContainer.classList.contains('ibexa-field-edit--required');
const isEmpty = !event.target.value;
const isError = isEmpty;
const isError = isRequired && isEmpty;
const label = event.target.closest(SELECTOR_FIELD).querySelector('.ibexa-field-edit__label').innerHTML;
const result = {isError};
if (isEmpty) {
Expand Down

0 comments on commit 3f41c04

Please sign in to comment.