Wicket
  1. Wicket
  2. WICKET-4863

Customize ValidationError creation by FormComponent

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 6.2.0
    • Fix Version/s: 6.3.0
    • Component/s: wicket
    • Labels:
      None

      Description

      When the validation triggered in FormComponent.convertInput() fails, a ValidationError is reported. This ValidationError provides variable substitution for the error message. If you write your own implementation of IConverter and have control over the creation of a ConversionException, you can easily add custom variables to it, which then can be used for substitution. But in case you use one of the implementations provided by wicket, you can't add variables to the ConversionException.

      So I propose to add the possibility to modify the ValidationError object, so a FormComponent can append its own variables to it, or even overwrite values, add new message keys, ..

      I'll attach a patch - just need to figure out how I made a little refactoring and introduced a new method FormComponent.newValidationError(). It encapsulates the creation of the ValidationError and can be overwritten. It also reduces some duplicate lines of code.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Benedikt Schlegel
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development