9. Februar 2012

Bean Fields for Grails renders form fields easily

Bean Fields, a new plugin for Grails, provides a suite of tags for rendering form fields for domain and command objects. As the developers claim, it takes the pain, boredom and scope for error away.

Out of the box it:

  • renders a field using a UI element appropriate for the property type. Constraints are used to set maximum lengths etc.
  • automatically renders
  • renders “required” indicators if the field is nullable:false and/or blank:false
  • renders errors adjacent to the field that had the error
  • renders the current value as appropriate

Here’s an example of how you can render all this for a bunch of bean properties:

<bean:withBean beanName="form">
    <bean:field property="firstName">
    <bean:field property="lastName">
    <bean:field property="company">
    <bean:field property="email">
</bean:withBean>

You can find more elaborate examples as well as instructions for use on the plugin page.

Diese Artikel könnten Sie noch interessieren:

  1. Scaffolding in Grails: More than a one-night stand? Scaffolding in Grails (from my point of view) is like...
  2. I18N-Problem in Grails Wenn man eine mehrsprachenfähige Webanwendung erstellen will, unterstützt Grails recht...
  3. Paypal plugin 0.5 for Grails released today David Russell notified me about a bug in the Paypal...
  4. Apache Camel plug-in for Grails The Apache Camel Grails plug-in allows you to send and route...
  5. Make your Grails app show content There is a great way to show content from inside...

Ihre Meinung ist uns wichtig

*