Grails Extra Validators

  • Authors: Antony Jones
1 vote
Dependency:
compile ":extra-validators:0.2"

 Documentation

Summary

Provides a bundle of extra validators for grails

Installation

grails install-plugin extra-validators

Description

Provides validators in addition to the grails default validators, currently:
  • Postcodes
    • United Kingdom
    • United States
    • Canada
  • Password confirmation
Postcode Validation

Use the postcode validator in your domain/command/@Validatable classes as follows:

static constraints = {
    postcode postalCode: PostalCountry.UK
}

To determine which country your postcode validates as, set it's parameter to the PostalCountry value of your choice (currently one of UK, US, CA).

Password confirmation validation

static constraints = {
    password confirmedPassword: 'passwordConfirmation'
}

In the example above, the validator validates that the value of the field 'password' is equal (confirmed by) the value of the field 'passwordConfirmation'.