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']" />

This entry was posted in Programming and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *