August 27, 2010

tapestry 5 custom validation error message

in our system/ configuration, in order to customize T5 validation messages using the T5 validation message language key conventions, i had to use the following language keys:
  • "required" as language key for a required field
    - f.ex. when i use t:validate="required" in a .tml file
  • "number-format-exception" for a number field, and integer-format-exception for an integer field
    - when an input field attached to an integer property gets a letter, f.ex. 
using "%s" in the language expression will give access to the name of the field, f.ex. having an error message like "%s must be completed".
    what did NOT work for us, even if it worked for others (ref information below), was any prefix with field or form name, or a postfix of -message...


    Apache Tapestry - Form Input and Validation:
    Customizing Validation Messages

    Each validator (such as "required" or "minlength") has a default message used (on the client side and the server side) when the constraint is violated; that is, when the user input is not valid.

    The message can be customized by adding an entry to the page's message catalog (or the containing component's message catalog). As with any localized property, this can also go into the application's message catalog.

    The first key checked is formId-fieldId-validatorName-message.
    • formId: the local component id of the Form component
    • fieldId: the local component id of the field (TextField, etc.)
    • validatorName: the name of the validator, i.e., "required" or "minlength"
    If there is not message for that key, a second check is made, for fieldId-validatorName-message.

    If that does not match a message, then the built-in default validation message is used.

    http://tapestry.1045711.n5.nabble.com/T5-Overriding-integer-validation-message-td2436931.html#a2436931:

    (from the answers)

    You should add a prefix consisting of the field id (and optionally the form 
    id).
    (Igor)

    To generalize messages overrides for all form, you can contribute to ValidationMessagesSource service in your AppModule class with your own
    property file. (Christophe)

    Trial and error have yielded: [field id]-integer-message  (xfile80303)
    Blogged with the Flock Browser

    Dennis Stevens: We are Doing QA All Wrong

    A few interesting things from an article by Dennis Stevens, very loosely quoted...

    • We Don’t Understand Quality Assurance
    • We Don’t Understand the Cost of Rework
      • Rework from failed QA tests are extremely expensive to flow. Sending work back into development interrupts work in process. This has a dramatic effect on cycle time across the system – which results in increased cost of every item in the system.
    • the cost of setting up testing environments is much lower
    • Quality Assurance needs to be part of the development team and process. We need to change our thinking around this. So we need to integrate Quality Assurance very early in the process.
    • We have the Wrong Expectations
      • We Expect Perfection - Not Improved Value
      • We Expect Local Optimization - Not Flow
    • Enable value, flow, and ongoing improvement
    Dennis Stevens » Blog Archive » We are Doing QA All Wrong 

    From the comments:
    • One thing: No one can assure quality. Can I convince you to change the reference to “Quality Assistance?” (Jon Bach)
    • I prefer ‘testing’ and ‘tester’ to ‘quality assurance’ and ‘QA engineer’ or whatever. But these are nits. The message of Dennis’s post is the point – focus on value, improvement, delivering a better product. (Lisa Crispin)
    • I introduce myself to teams as the “public health nurse” for their project, and then subtly place ‘quality assistance’ in my email signature. (Adam Geras) 
    • testing is a complex, organic, cognitive activity, rather than a rote, bureaucratic, clerical one. (Michael Bolton)  

    Blogged with the Flock Browser