Trimmer Plugin

  • Tags: /
  • Latest: 0.1
  • Last Updated: 04 September 2012
  • Grails version: 1.3 > *
4 votes
Dependency:
compile ":trimmer:0.1"

 Documentation  Source  Issues

Summary

Trim all String input + convert an textinput that contains only blanks into null.

Installation

grails install-plugin trimmer

Description

As of grails >= 2.3 and later this plugin is not needed any longer because the default behaviour has changed to exactly what this plugin was achieving.

Trimmer Plugin - Trim all inputs

Did you ever wish to easily avoid leading and trailing spaces from being persisted in your DB by bad inputs ?

Then this plugin is for you.

Basically I think this plugin is needed in any serious grails application out there :)

Installation

Simply install via BuildConfig.groovy or with

grails install-plugin trimmer

and you are good to go.

Please try using BuildConfig.groovy as the later is deprecated.

All inputs will be trimmed and inputs that consist of blanks only will be converted to null.

Caveat

There is no way (yet) to disable this behavior for a given given input field. Good thing I can't think of a possible input were leading or trailing spaces would be of valuable information. If there are ideas of how to make this a configurable behavior (be able to turn trimming of for certain fields), I'm more then interested.

Credit

This plugin is based on GRAILS-6901 so the credits go to Göran Ehrsson.