This page last changed on Feb 17, 2006 by [email protected].

Tag - validate

At the idea stage, not yet implemented!

Description

Allows client-side validation of domain class constraints against a form.

Parameters

  • form - The name of the form
  • against - The class name of the domain class

Examples

Example domain class:

class User {
     @Property String login
     @Property String pwd

     @Property constraints = {
           login(length:5..15,unique:true)
           pwd(length:5..15)
     }
}

 

The below used submits to a "login" action. The field names match those within the class defined about:

<form name="userForm" action="login">
        <input type="text" name="login" />
        <input type="password" name="pwd" />
</form>

 

This allows us to apply the validate tag against the constraints set in the domain class and produce the necessary
javascript to perform client side validation. Tag usage:

<g:validate form="userForm" against="User" />

 

Document generated by Confluence on Mar 29, 2006 08:46