Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Wicket-1.1 post rc2 provides a much simplified approach by introducing the ${label} variable in the validation context which represents the user-centric name of the form component and allows factoring out validator-specific messages into one place.
_IMPORTANT: This only works correctly, when getResourceSettings().getUseDefaultOnMissingResource is true !

The ${label} variable can be provided by one of two ways:
It can either be set directly on the form component instance by calling setLabel(IModel model) method, or by including a resource key of the form form-id.relative_path_to_form-component-id.

IMPORTANT: If your form component is a child of another component (e.g. Border) and isn't being directly added to the form component itself, then you need to use the relative path to the component.  

...

This approach makes it much simpler to maintain error messages in forms.

Since 1.2 (CVS HEAD) the following features have been added:
Let's say you have the following component hierarchy:

...

Code Block
YPanel.properties:
   foo.RequiredValidator = Foo is required.

...

Changes in Wicket 1.3

Wether a field is required is now determined by testing the isRequired() method of FormComponent, therefore 'RequiredValidator' in the above examples has to be replaced by 'Required'.