Uploaded image for project: 'Blossom'
  1. Blossom
  2. BLOSSOM-279

Validator configuration is not working when using validators in Blossom dialogs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None

      If a validator is configured for a field inside a Blossom dialog, a template error occurs when the dialog gets loaded for editing. The dialog cannot be opened.

      The cause for this error is the getValidatorName() method in the class

      info.magnolia.ui.form.validator.definition.FieldValidatorDefinitionKeyGenerator

      In line 45 the getName() method of the ConfiguredFieldValidatorDefinition instance is called. This returns null for a validator configured with Blossom. When null is passed to the of method of Optional, a NullPointerException is thrown:

      return definition instanceof ConfiguredFieldValidatorDefinition?
      Optional.of(((ConfiguredFieldValidatorDefinition)definition).getName()):Optional.empty();
      

      Example code:

      @TabFactory("Content")
      public void contentTab(UiConfig cfg, TabBuilder tab, DialogCreationContext context) throws InvalidPathException {
      
      tab.fields(
          cfg.fields.text("items").label("Number of items").defaultValue("10").validator(cfg.validators.digitsOnly()));
      
      }
      

      This bug is related to an already existing open issue in #BLOSSOM-245

        Acceptance criteria

              Unassigned Unassigned
              serdmann Stephan Erdmann
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:

                  Bug DoR
                  Task DoD