Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-4800 Layouts/widgets improvements
  3. NXP-4934

Add a generic way to declare validators on builtin widget types

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: 9.10
    • Component/s: Layouts & Widgets

      Description

      Most of standard widget types are using standard JSF components, that accept
      standard validators. There are two ways to declare a validator on a JSF component:

      • use the "validator" property to declare a method binding that will perform the
        check and throw a ValidatorException error if validation fails. This is already
        available.
      • add a tag inside the component to declare another validator. For instance:
        <h:inputText value="# {field_0}

        ">
        <f:validateLongRange minimum="1"/>
        </h:inputText>

      The "f:validateLongRange" is a standard validator. The "f:validator" tag also makes
      it possible to declare a validator by id.

      Custom validators can also be added to the framework. For instance, ui-web defines
      validators "nxu:validateFileSize" and "nxu:validateFileMimetype" that can be used
      inside the "nxu:inputFile" tag.

      As these tags all accept specific attributes, maybe a generic way to declare them on
      the resulting component would be needed.

      Another idea would consist in defining validation rules on the layout, so that condi-
      tions can be easily expressed in a el-like language, with some variables exposed (to
      define.

      Syntax is still to discuss.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: