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

        Benedikt Schlegel created issue -
        Benedikt Schlegel made changes -
        Field Original Value New Value
        Attachment FormComponent.newValidationError.patch [ 12552984 ]
        Martin Grigorov made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Martin Grigorov [ mgrigorov ]
        Fix Version/s 6.3.0 [ 12323327 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        4d 16h 46m 1 Martin Grigorov 15/Nov/12 08:48

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development