Monthly Archives: October 2014

Grails Bootstrap Form Field Error Template

Define a Grails template in /layouts/_formFieldError.gsp <div class=”form-group has-error”> <g:hasErrors bean=”${fieldModel}” field=”${fieldName}”> <div class=”errors”> <g:eachError bean=”${fieldModel}” field=”${fieldName}”> <span class=”help-block”><g:message error=”${it}”/></span> </g:eachError> </div> </g:hasErrors> </div> Usage <g:render template=”/layouts/formFieldError” model=”[fieldModel: myModelObject, fieldName: ‘myFieldName’]” />

Posted in Programming | Tagged , , | Leave a comment