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

Cannot (easily) provide custom error message with custom validator

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 1.2.4, 1.3
    • 1.1.4
    • None
    • None

      I've created a new module (magnolia-module-enterprise-validation) in which I've implemented a new validator. (This validator is to be shipped separately from the Form module.)

      At the moment, there is no straightforward way to show a custom error message upon failed validation for this validator - the default "invalid input" is not appropriate for this validator. I.e., it is not possible for the validator to show a custom error message in this setup:

      • Add the validator to config:/modules/form/config/validators as 'enterpriseEmail' (using a bootstrap file)
      • Use the validator for a form field by selecting it there.

      Showing a custom error message would require unneccessarily invasive changes to the form as a whole.

      A workaround is to show the default error message, but add a prominent hint next to the validated field like: "Addresses from free email providers will not be accepted."

        Acceptance criteria

              ochytil Ondrej Chytil
              frabe Felix Rabe
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD