RequiredValidationDelegate

Description

This RequiredValidationDelegate is a simple but very handy extention of the default ValidationDelegate.

It is capable of rendering a '*' to the right of a input field that has a RequiredValidator associated. It is a neat extention has you now longer has to manually keep your required html input fields in sync with your RequiredValidators.

Further more it uses css instead of the font tag to mark any required fields an fields in error.

Example

The RequiredValidationDelegate is created as any other ValidationDelegate in tapestry. But the html generated is slightly different:

A field in error is marked as following (The default ValidationDelegate marks with the font tag and two '**' stars):

<span class="error">!</span>

A field having a RequiredValidator associated is marked as following (The default ValidationDelegate doesn't contain any logic to mark a field like this):

<span class="required">*</span>

You configure the RequiredValidationDelegate as a bean in the specification file as you whould have done with any other ValidationDelegate:

<bean name="requiredValidationDelegate"
      class="com.nordija.tapestry.bayeux.delegate.RequiredValidationDelegate" />
Then you associate the RequiredValidationDelegate with the form like this:
<form jwcid="@Form" clientValidationEnabled="true"
      delegate="bean:requiredValidationDelegate" success="listener:formListener">
    ...
</form>