Validation Field

  • Tags: /
  • Latest: 0.2
  • Last Updated: 13 May 2010
  • Grails version: *
  • Authors: null
2 votes
Dependency:
compile ":validation-field:0.2"

 Documentation

Summary

Installation

grails install-plugin validation-field

Description

Please, take a look in the Screenshots.

Para documentación en español, visite http://latingrails.blogspot.com

Full documentation in http://latingrails.blogspot.com/2010/04/grails-validation-plugin-errorfield.html

The ValidationField plugin is very usefull, it allow us to insert html input and textArea fields in your GSP files, that will show automatocally if the field has any domain validation error (coming soon it will support other html form elements as select tags).

HOW TO START TO USE IT?

  1. INSTALL THE PLUGIN:
grails install-plugin validation-field

2. USE IT:

INCLUDE the <g:validationFieldIncludes /> tag between the <head></head> tags, in your GSP page. (To import the CSS file)

FOR INPUT AND TEXTAREA HTML FORM TAGS

Use the <g:validationField tag='input' type='text' domain="${myObject}" field='theObjectProperty' /> tag to render input form elements that will show any validation error. To render a textArea element use the same tag just like this: <g:validationField tag='textArea' domain="${myObject}" field='theObjectProperty' >

You can use any HTML input property ( id, name, class, style, etc ) in your <g:validationField /> tag

FOR SELECT HTML FORM TAGS

Use the tag:

<validationSelect />

You can use the same properties as in the <g:select /> Grails tag ( http://grails.org/doc/1.1.x/ref/Tags/select.html )

Example:

<validationSelect from="${Country.list()}" domain="${user}" field="country" name="country.id" />

ADVANCED USAGE (other properties):

value:Value by default to be shown.

messageErrorClass: Your CSS class, if you want to overwrite the default plugin CSS class to use in the error/validation message.

fieldErrorClass: Your CSS class, if you want to overwrite the default plugin CSS class to use in the error/validation form field.

customErrorMessage: A custom message to be shown if you don't want to show the grails validation default message.

showMessage: String (true or false) that indicate if you want to show the validation message of just the field with the red border (or style changed).

More info in: http://latingrails.blogspot.com (Documentación en español)