Tag - validate

Last updated by admin 10 months ago
This page is deprecated

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 {
     String login
     String pwd

def 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" />