Uploaded image for project: 'Magnolia Form Module'
  1. Magnolia Form Module
  2. MGNLFORM-398

Custom Validators cannot be used within the edit form dialog

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • 2.7.8
    • None
    • None

    Description

      Steps to reproduce

      1.  Create a java module with the provided Validator
      2.  Open Configuration app and move to /modules/form/dialogs/formStep/form/tabs/tabMain/fields/formName
      3. Select the formName node and import the attached xml
      4. Go to Resources app and edit /mtk2/templates/pages/basic.yaml
      5. Include the following component within the main area:
        mtk2/templates/pages/basic.yaml
        form:
          id: form:components/form
      6. Open pages app and create a Basic page
      7. Within the main area, create a Form component
      8. Type something within the Form name field
      9. Check nothing is printed at console (Validator should have printed "Custom unique phone number validation executed")
      10. Go to Definitions app and check a minor error is displayed within the Problems tab:

        Definition: form:formStep
        Origin: /modules/form/dialogs/formStep
        Details: Element [my.company.filter.UniquePhoneNumberValidatorDefinition@280e405f] of type [my.company.filter.UniquePhoneNumberValidatorDefinition] may not be added to the collection of type [interface info.magnolia.ui.form.validator.definition.FieldValidatorDefinition]
        Location: /form/tabs/tabMain/fields/formName/validators/uniquePhone
        Type: Source data processing problem
        Severity: MINOR

      Expected results

      The custom field validator works

      Actual results

      Validator cannot be used within the form module (form component)

      Workaround

      N/A

      Development notes

      The very same validator works if defined as a field validator at other components (e.g, at a TextField component)

      If we switch the Validator definition to the old UI, we still get an error:

      WARN class my.company.filter.UniquePhoneNumberValidatorDefinition$ByteBuddy$LBqhP0eh doesn't have replacement in new ui framework. So it can't be converted and as such is skipped.

       

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              ccantalapiedra Carlos Cantalapiedra
              AuthorX
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD