Main Page

From GValidationWiki

Jump to: navigation, search


What is GValidation

GValidation is a validation plugin for Griffon - A Grails like application framework for developing desktop applications in Groovy. Like most part of the Griffon framework GValidation's syntax and usage closely resemble its cousin Grails' validation and constraints support. However the similarity pretty much stops here, since Griffon model are very different from Grails' concept of model. In Grails model usually refers to domain classes that are bound to database, however in Griffon models are usually just mere POGOs thus this plugin is designed to work with Griffon models as well as any POGOs.

GValidation is written purely in Groovy while retaining most of the syntax of Grails constraints support.

Project Page

SourceForge Project Page


GValidation plugin depends on the following libraries, and will automatically add them to your application once the plugin is installed

Apache Commons Lang 2.5
Apache Commons Validator 1.3.1
Jakarta ORO 2.0.8

Installation & Upgrade

griffon install-plugin validation

Report a Bug

Please use the Bug Tracker to report any bug you find

How does GValidation work?

Once this plugin is installed automatically all your model object will have a dynamic field errors and a dynamic method validate injected similar to Grails domain class. The errors field encapsulates all errors generated on a particular model, and the validate method performs validation based on the constraints you configure. Here is a typical usage scenario:

First: Delare Constraints on your Model

class PersonModel {
    @Bindable String name
    @Bindable String email
    @Bindable String blog

    static constraints = {
        name(blank: false)
        email(blank: false, email: true)
        blog(url: true)

Second: Perform Validation in your Controller

        if (!model.validate()) {
            doLater {
                // display error messages
        } else {
            doLater {
                // do the real job

More on Griffon Validation Plugin

Want to find out more about GValidation plugin? Please check out our official Wiki site Griffon Validation Plugin Wiki

Personal tools