Skip to content

Instantly share code, notes, and snippets.

@dtanner
Created September 27, 2013 14:43
Show Gist options
  • Save dtanner/6729676 to your computer and use it in GitHub Desktop.
Save dtanner/6729676 to your computer and use it in GitHub Desktop.
Allow class attribute on a custom Grails Fields template
<%@ page defaultCodec="none" %>
<div class="form-group ${formGroupClass ?: ''} <g:if test="${invalid}">has-error</g:if>">
<label class="control-label ${labelClass ?: ''}" for="${property}">${label} <%=required ? "*" : ""%></label>
<input type="<%=type ?: "text" %>" name="${prefix ?: ''}${property}" id="${prefix ?: ''}${property}" value="${value}" <%=constraints.maxSize ? "maxlength=${constraints.maxSize}" : ""%> <%=readonly ? "readonly=readonly" : ""%> class="form-control <%= pageScope["class"] ?: '' %>" <%=placeholder ? "placeholder='$placeholder'" : ""%>/>
<g:if test="${helpText}"><span class="help-block">${helpText}</span></g:if>
<g:if test="${invalid}"><span class="help-block">${errors.join('<br>')}</span></g:if>
</div>
<f:field bean="person" property="phone" class="phone"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment