Skip to content

Commit

Permalink
Merge pull request #166 from netgen/NGSTACK-794-validation
Browse files Browse the repository at this point in the history
NGSTACK-794 add check if tags field is actually required before valid…
  • Loading branch information
emodric authored Feb 14, 2025
2 parents d69d8f6 + 3f41c04 commit 6713bb0
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 6713bb0

Please sign in to comment.