Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

## org.codehaus.groovy.grails.plugins.web.taglib
[Groovy] Class ValidationTagLib

    java.lang.Object
      org.codehaus.groovy.grails.plugins.web.taglib.ValidationTagLib

    class ValidationTagLib

Tags to handle validation and errors.

Authors:
  Graeme Rocher

Property Summary
`static java.lang.Object` | `CONSTRAINT_TYPE_MAP`
`java.lang.Object` | `eachError` Loops through each error for either field or global errors.
`java.lang.Object` | `fieldError` Renders an error message for the given bean and field.
`java.lang.Object` | `fieldValue` Obtains the value of a field either from the original errors.
`java.lang.Object` | `hasErrors` Checks if the request has errors either for a field or global errors.
`java.lang.Object` | `message` Resolves a message code for a given error or code from the resource bundle.
`java.lang.Object` | `renderErrors` Loops through each error and renders it using one of the supported mechanisms (defaults to "list" if unsupported).
`static java.lang.Object` | `returnObjectForTags`
`java.lang.Object` | `validate` Validates a form using Apache commons validator javascript against constraints defined in a Grails domain class.

Method Summary
`java.lang.Object` | `eachErrorInternal(java.lang.Object attrs, java.lang.Object body, boolean outputResult = false)`
`java.lang.Object` | `extractErrors(java.lang.Object attrs)`
`java.lang.Object` | `formatValue(java.lang.Object value, java.lang.String propertyPath = null)` Formats a given value for output to an HTML page by converting it to a string and encoding it.
`java.lang.Object` | `messageImpl(java.lang.Object attrs)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Property Detail

### CONSTRAINT_TYPE_MAP

    static java.lang.Object CONSTRAINT_TYPE_MAP

### eachError

    java.lang.Object eachError

  Loops through each error for either field or global errors.
  attr:
    bean REQUIRED The bean to check for errors
  attr:
    field REQUIRED The field of the bean or model reference to check
  attr:
    model The model reference to check for errors

### fieldError

    java.lang.Object fieldError

  Renders an error message for the given bean and field.
  eg. <g:fieldError bean="${book}" field="title" />
  attr:
    bean REQUIRED The bean to check for errors
  attr:
    field REQUIRED The field of the bean or model reference to check
  attr:
    message The object to resolve the message for. Objects must implement org.springframework.context.MessageSourceResolvable.
  attr:
    encodeAs The name of a codec to apply, i.e. HTML, JavaScript, URL etc
  attr:
    locale override locale to use instead of the one detected

### fieldValue

    java.lang.Object fieldValue

  Obtains the value of a field either from the original errors.
  eg. <g:fieldValue bean="${book}" field="title" />
  attr:
    bean REQUIRED The bean to check for errors
  attr:
    field REQUIRED The field of the bean or model reference to check

### hasErrors

    java.lang.Object hasErrors

  Checks if the request has errors either for a field or global errors.
  attr:
    bean REQUIRED The bean to check for errors
  attr:
    field REQUIRED The field of the bean or model reference to check
  attr:
    model The model reference to check for errors

### message

    java.lang.Object message

  Resolves a message code for a given error or code from the resource bundle.
  attr:
    error The error to resolve the message for. Used for built-in Grails messages.
  attr:
    message The object to resolve the message for. Objects must implement org.springframework.context.MessageSourceResolvable.
  attr:
    code The code to resolve the message for. Used for custom application messages.
  attr:
    args A list of argument values to apply to the message, when code is used.
  attr:
    default The default message to output if the error or code cannot be found in messages.properties.
  attr:
    encodeAs The name of a codec to apply, i.e. HTML, JavaScript, URL etc
  attr:
    locale override locale to use instead of the one detected

### renderErrors

    java.lang.Object renderErrors

  Loops through each error and renders it using one of the supported mechanisms (defaults to "list" if unsupported).
  attr:
    bean REQUIRED The bean to check for errors
  attr:
    field REQUIRED The field of the bean or model reference to check
  attr:
    model The model reference to check for errors

### returnObjectForTags

    static java.lang.Object returnObjectForTags

### validate

    java.lang.Object validate

  Validates a form using Apache commons validator javascript against constraints defined in a Grails domain class.
  TODO: This tag is a work in progress
  attr:
    form REQUIRED the HTML form name
  attr:
    againstClass REQUIRED the domain class name

Method Detail

### eachErrorInternal

    java.lang.Object eachErrorInternal(java.lang.Object attrs, java.lang.Object body, boolean outputResult = false)

### extractErrors

    java.lang.Object extractErrors(java.lang.Object attrs)

### formatValue

    java.lang.Object formatValue(java.lang.Object value, java.lang.String propertyPath = null)

  Formats a given value for output to an HTML page by converting it to a string and encoding it. If the value is a number, it is formatted according to the current user's locale during the conversion to a string.

### messageImpl

    java.lang.Object messageImpl(java.lang.Object attrs)

Groovy Documentation