ModelTagLib

Take a look at this before creating your Grails forms:

The Elevator Pitch

Currently to render fields that are aware of domain class constraints such as maximum field length, “inList” options in a select box etc, you have a fair bit of manual coding to do in your GSP pages.

You want tags that are constraint-aware, and also aware of the current values of fields, and able to display the errors of a field next to the field itself on the form. You also want to not have to do

That’s what this taglib does.

http://grails.org/Draft_ModelTagLib

Matt

More grails fun

Hidden validation error messages

If you have a def book = new Book(title:’Ala ma Kota’).save() and the constraints are violated by it, you’ll get a null returned from save() as a result.  But how to find what is the problem with new Book()?  Well, it’s a secret.  Use book.errors.allErrors to get the list of errors and println  on them.  And by the way, they will not show up in the unit test stdout.  See next bullet for this.

Hidden unit test error log

Unit tests send errors to a file well hidden in /target folder.

What I learned today…

NCPDP format is in fact related to the EDIFACT standard. The EDIFACT standard is used mostly in the “rest of the world” whereas the X12 standard (each transaction type is designated with a number from 1-999) is used mostly in the U.S of A.