Validation, message, form

Its in the cookbook: Creating Unique Field Rules