Thursday, 19 September 2013

Best way to pass css class attribute to grails fields plugin custom template

Best way to pass css class attribute to grails fields plugin custom template

Working with the Grails Fields plugin, I have some custom templates for
which I'd like to pass in an attribute named class (for CSS styling).
e.g. Here's what I want to do:
<f:field property="someProperty" class="someCustomCssClass" />
The problem is I can't simply look for the "class" property in the custom
template, as that's a reserved word. I'd rather not use a different
attribute name like "cssClass", because then I can't easily swap between
default fields template usage and custom fields template usage.
The only thing I can think of so far is to parse the "widget" property and
grab the class out of that String, but is there a better way to grab the
value of the class attribute in a custom fields template?

No comments:

Post a Comment