Grails: How to make everything I create Upper Case?

randomizertech picture randomizertech · Oct 25, 2010 · Viewed 13.9k times · Source

I am currently using CSS to change everything I write to upperCase when I create an entry, but that is not enough. When I save things, the text shown in the text fields is upper case, but the real value that Grails stores stays in lower case.

I am assuming I'd need to change something in the controller or anything.

Maybe transforming the $fieldValue CSS could work??

Any ideas would help!

Thnks!

Answer

tim_yates picture tim_yates · Oct 25, 2010

You could just write setters for your domain object?

class Domain {
 String aField

 void setAField( String s ){
   aField = s?.toUpperCase()
 }
}