Tapestry 5
  1. Tapestry 5
  2. TAP5-692

T5 should pick up validators to be applied to a field from the containing component's .properties file.

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.0
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      Currently, there are two core-supported methods for specifying the validators to be applied to a particular form field: the @Validator annotation, and the validate attribute. Tapestry supports, however, specifying constraints to a specific validator in the .properties file. For instance:
      <t:textfield t:id="someField" validate="regexp">

      Could have an entry in the .properties file such as:
      someField-regexp=^\d+$
      someField-regexp-message=You must input a number for someField

      What would be equally nice is to be able to specify the actually regexp validator as a constraint in the .properties file:

      someField-validators=regexp

      Or
      someField-validators=required,regexp

      This would be helpful for using, eg, BeanEditForm, where you might want to specify the constraints for a large number of fields, don't want to provide parameters for each of those fields, and you don't have access to the source to add @Validator to each of the properties.

      This will probably take the form of a new ValidationConstraintGenerator, but there may be some additional "plumbing" involved to get access to the containing page/component's message catalog.

        Activity

          People

          • Assignee:
            Robert Zeigler
            Reporter:
            Robert Zeigler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development